When do you get that error? After hosting in IIS or when debuggin with Visual Studio. If it occurs after hosting in IIS, try by giving the execute permission to
ISUR for that particular program. If it occurs while debugging with VS, try by giving execute permission to ASPNET for that particular program. Following link will help you with that. See the animation.
Just out of curiosity, you do realise that you cannot display this .exe or process to the user in asp.net dont you?
If this code successfully executed, all that would happen is that the process or executable would run or open on the iis server and would
not be displayed to the user.
You said you gave permission to IUSR, that won't work. The account that is running the process has to be some other account. IUSR is set that way for security reasons. Have you tried setting the app pool identity to some local process account?
anshuljindal
Member
13 Points
29 Posts
Access is Denied calling .exe from web page
Jun 27, 2012 10:49 AM|LINK
Hi All,
This is my code to call a .exe file in C# Web page.
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.WorkingDirectory = "W:\\inetpub\\wwwroot\\abc\\Xyx\\";
process1.StartInfo.FileName = "FileName.exe";
process1.Start();
Whenever i call this code it gives me following error
Message: Access is denied
StackTrace: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
Please help me to get out from this. My need here is simple i want to call a .exe file through web page.
Thanks in advance
Anshul
system.diagnostics
Anshul Jindal
bbcompent1
All-Star
33062 Points
8516 Posts
Moderator
Re: Access is Denied calling .exe from web page
Jun 27, 2012 10:58 AM|LINK
You have to be using an account that has admin privileges in the app pool identity.
anshuljindal
Member
13 Points
29 Posts
Re: Access is Denied calling .exe from web page
Jun 27, 2012 11:20 AM|LINK
Any related expamle for this
Anshul Jindal
bbcompent1
All-Star
33062 Points
8516 Posts
Moderator
Re: Access is Denied calling .exe from web page
Jun 27, 2012 11:21 AM|LINK
See this MS link: Specify an Identity for an Application Pool (IIS 7)
Ruchira
All-Star
43018 Points
7031 Posts
MVP
Re: Access is Denied calling .exe from web page
Jun 27, 2012 02:28 PM|LINK
Hello,
When do you get that error? After hosting in IIS or when debuggin with Visual Studio. If it occurs after hosting in IIS, try by giving the execute permission to ISUR for that particular program. If it occurs while debugging with VS, try by giving execute permission to ASPNET for that particular program. Following link will help you with that. See the animation.
http://support.yessoftware.com/kb_article.asp?article_id=4
Following link will help you too
http://www.livio.net/main/writepermissions.asp
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.anshuljindal
Member
13 Points
29 Posts
Re: Access is Denied calling .exe from web page
Jun 28, 2012 05:24 AM|LINK
I have given the permission to iUSR but still it is showing access is denied :(
Anshul Jindal
niceastham
Member
645 Points
175 Posts
Re: Access is Denied calling .exe from web page
Jun 28, 2012 07:08 AM|LINK
Just out of curiosity, you do realise that you cannot display this .exe or process to the user in asp.net dont you?
If this code successfully executed, all that would happen is that the process or executable would run or open on the iis server and would not be displayed to the user.
anshuljindal
Member
13 Points
29 Posts
Re: Access is Denied calling .exe from web page
Jun 28, 2012 12:50 PM|LINK
I don't want to display anything to user. i just to execute one process that is in .exe after some operation.
Anshul Jindal
bbcompent1
All-Star
33062 Points
8516 Posts
Moderator
Re: Access is Denied calling .exe from web page
Jun 28, 2012 01:39 PM|LINK
Does this .exe live inside your web site?
bbcompent1
All-Star
33062 Points
8516 Posts
Moderator
Re: Access is Denied calling .exe from web page
Jun 28, 2012 01:40 PM|LINK
You said you gave permission to IUSR, that won't work. The account that is running the process has to be some other account. IUSR is set that way for security reasons. Have you tried setting the app pool identity to some local process account?