Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i have a simple ASP.NET Application that has a button btn1. when i click the btn1 i want to start an executable file for example c:\test\myfile.exe .

1. when i run the application from visual Studio 2010 all works fine.
2. when i run the application from IIS on another system or even from IIS on the same system the process myfile.exe starts but it never shows on the Desktop.

i checked the task manager the application myfile.exe is running.

I tried many things was suggested like impersonation, running the IIS Service with local system and check interact with desktop....

non of these worked.

Can you please help and give step by step recomendations

Best Regards

Ben
Posted
Comments
Kornfeld Eliyahu Peter 13-May-15 7:27am    
Can you show your code to run the executable?

The account your code is running under will be the anonymous user which doesn't have access to the desktop of the person who is logged in. It works on your local machine as your code is running under your account so has access to your desktop.

You need to change the anonymous user to the same account as the logged-in user for the exe to have access to the desktop. Note that you can't launch exes on the client or access the client's desktop. As no-one is on the server in order to see the GUI, or the server might have no-one logged in, it's a little pointless even doing what you're trying to do, re-write your code as a console app or something that needs no GUI.
 
Share this answer
 
Simple.
In development, your Client and Server are the same computer. Which means that when your C# code starts a process, or displays a message box you get to see it.

In production...they aren't. So the C# code - which is executed on the server - starts a process on the server, which runs on the server using IIS permissions. The client will never see it. There is a good chance that the app will not run at all, because the use that IIS is running under doesn;t have sufficient access permissions for the folder: that's pretty normal, to prevent rogue apps from doing nasty things. To fix that, you would have to ensure the sufficient permissions are given to that folder for teh right individual.

But one thing is for sure: your C# code cannot and will not start a process that the client will ever be able to see.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900