• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Execute application on the active session and out of session 0 with IIS service

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running asp.net website on IIS its run on service. and I want to open Excel file with GUI, so I must use the active session.

What I have tried:

This is my aspx file:




This is my aspx.cs file:

It makes the next error http://prntscr.com/g4q1uo

And when I use another solution like



It's open the Excel process(when I look at task manager). But I need the GUI so I have to run It on the active session. Anyone know an easy way to do so? can you give me any example code? I just have no idea...

for ProcessExtensions, I use this https://github.com/murrayju/CreateProcessAsUser

For the second solution after a lot of tries when I use remote debugging I just getting stuck on process1.Start(); and after time out I got an error on process1.WaitForExit(); because of



Hope for that someone will help, Thanks

Sory if I am doing something wrong, don't devote my question, tell me before that, please...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If I understand, you have your website, hosting in the same PC as the user?
So, when the user clicks on the button, you want to open Excel?

If so, you can Impersonate some part of your code with a specific user, like that you can take his rights for just the Excel portion of code :
https://support.microsoft.com/en-us/help/306158/how-to-implement-impersonation-in-an-asp-net-application
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This does sound like a security/permissions issue.
I do have a couple of notes/thoughts as seen below

It appears as though you are trying to get Excel to open on the server, which I would not recommend for the following reasons:
  • Usually no one is actively in front of the server, think mid night on a weekend when no one is in.
  • If the program (Excel) is opened by more then one user at a time you could run into concurrency issues.
  • Excel is a client side program and using it on the server uses up server resources. Depending on the Excel file you could be using more then 50 MB of memory per an active session in Excel only.
  • It could be rather difficult to track any changes made to the Excel file by any one user when it's opened

  • An alternative could be to:
  • Have C# use Excel as a datasource to display the data.
  • Use a JavaScript library to make an online Excel like interface for your data. There are at least a few to choose from, depending what what functionality you need/want.
  • If the end user is only viewing the data then you can display the data as a simple HTML table.
  • Have the C# code send the Excel file to the end user, forcing the end user to open Excel on their local system to edit it.
  •  
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!