Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends

I have used process.start to run a bat file. This opens command prompt and works well in Asp .net code. But if I take build and deploy in inetmgr, it does not work. It does not even invoke command prompt.
Can anyone help me.
Here is the code.
C#
Process objProcess = new Process();
        ProcessStartInfo objStartupInfo = new ProcessStartInfo();
        objStartupInfo.FileName = @"E:\Projects\Snif\SNIF3.0\SNIF3\web\SNIF\sniffiles\snifschedules\BatFiles\3523a7d9d8a-8df8-457e-8549-cdc8e103555d.bat";
        objStartupInfo.CreateNoWindow = true;
        objStartupInfo.UseShellExecute = false;
        objProcess.StartInfo = objStartupInfo;
        objProcess.Start();
        objProcess.WaitForExit();

Thanks in advance
Posted
Updated 25-Nov-10 1:04am
v2

1 solution

If you take the msdn page of ProcessStartInfo you' ll see that there are special security notes. The reason that it doesn' t work is that the asp page isn' t authorized to execute other assemblies and could also be denied access to the directory.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^]

http://msdn.microsoft.com/en-us/library/ee817643.aspx#authaspdotnet_relationship[^]

Good luck!
 
Share this answer
 
Comments
Dalek Dave 25-Nov-10 9:21am    
Good Call.
fjdiewornncalwe 25-Nov-10 10:12am    
I'll second that.

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