Connecting Tech Pros Worldwide Help | Site Map

C# WEB: Running an .exe file

Newbie
 
Join Date: Dec 2007
Posts: 7
#1: Dec 13 '07
Hey Guys and thanks for this community it has helped me quite a bit so far :)

However I ran into a problem that I couldn't find described anywhere so I go to you in hope of some help.

I have a webpage that has to scan some files that users post through this website. To do this I first save the file i a temporary folder where I scan using Symantec Scan Engine's (SSE) Command Line Scanner, which is simply an exe file that you can run with some parameters.
I have had it all to work beautifully, but I as booted up my computer this morning' to continue yesterdays work, all of the sudden there was an access denied on the exe file. I haven't touched the permissions to the file since when I set it up with ASPNET, IUSR and NETWORK SERVICE rights, so it really wonders me what could have gone wrong.
I therefore tried executing other exe files (ie. notepad) however this doesn't work either anymore, something which I also could prior to this morning.

I'm running two different machines to do this task, since the SSE requires a server solution. So where I'm developing the website is an XP Pro and the server is W2K3 server. If I copy my DLL to the server the thing still works beautifully, but on my workstation it constantly fails. I have tried copying the exe file around to different locations, but this hasn't yielded anything either.

I'm using
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process.Start(@"E:\\Inetpub\\wwwroot\\test\\ssecls.exe", "-server oxygen21:1344 -log " + logLoc+ " " + tempFileLoc);
Where logLoc is the location of where the logfile is written and the tempFileLoc is the location of the file to be scanned.
And even
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process.Start(@"E:\\Windows\\notepad.exe);
Fails to start now, which is really weird.

The error for the whole shebang is
Expand|Select|Wrap|Line Numbers
  1. System.ComponentModel.Win32Exception: Access Denied at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start(String fileName, String arguments) at Test.Test.Upload(Object sender, EventArgs e) in e:\inetpub\wwwroot\test\test.aspx.cs:line 61 
I hope someone has a clue, since I have no clue at all :)
Thanks in advance,

--Michael
radcaesar's Avatar
Moderator
 
Join Date: Sep 2006
Posts: 756
#2: Dec 13 '07

re: C# WEB: Running an .exe file


Its Seems that ASPNET account doesn't have enough rights to execute. Impersonate a user with admin rights in web.config file and then try.

:)
Newbie
 
Join Date: Dec 2007
Posts: 7
#3: Dec 13 '07

re: C# WEB: Running an .exe file


Hi radcaesar and thanks for your uber fast response :D

However I have failed to mention that I was already impersonating my own user which is administrator on both the server and on my workstation.

Expand|Select|Wrap|Line Numbers
  1. <identity impersonate="true" userName="oxygen\michael" password="*******" />
  2.  
And I made sure that I did have the rights to execute by ctrl-right click "Run As" my user (oxygen\michael).

Hope we can get to the bottom of this weird thing,
Thanks again :)
Newbie
 
Join Date: Dec 2007
Posts: 7
#4: Dec 13 '07

re: C# WEB: Running an .exe file


Hey again,
Hmm apparently it does have something to do with the impersonation, but on another weird level. I had run an application earlier today which had no impersonation but was still running the .exe file, after that I was unable to run any further exe files.
I added the impersonation and tried again but the access restrictions were still there, however after a reboot, I made sure that the first app I ran was the right one with the impersonation and now it runs fine again.

It's rather weird how one app can shut down the access to all exe files even from other apps. But it must have been somekind of a lingering thread or something like that.

For now I consider this solved, so thanks alot for pointing out the impersonation eventhough I thought I had taken care of it :)

So thanks again :)
Reply