• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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

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...
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 :
Posts: 1868
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.
    I've got no option but to sell you all for scientific experiments. Or a tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!