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

I have a batch file which I want to execute on the server from webapplication developer in

But when I use below code to run the batch file, I get access denied error.
ProcessStartInfo psi = new ProcessStartInfo();
        psi.FileName = Server.MapPath(ConfigurationManager.AppSettings["Path"]) + "TestingApplication.bat";

        Process proc = new Process();
        proc.StartInfo = psi;

Batch file is placed in the bin folder of the application.

My web application is using forms authentication.
I need to know how to provide premissions for execution of this batch file.
Updated 4-Apr-15 2:03am
CHill60 4-Apr-15 8:05am    
If you run the batch file manually do you get the same error?
rupali4 4-Apr-15 8:32am    
When I run the batch file manually it executes properly.
Even if I schedule this same batch file, it will execute.
ramyajaya 4-Apr-15 22:08pm    
Check this discussion to track your issue

1 solution

Web app processes run at a lower security level than users so you must make sure your web process has access to the batch file and what it is doing within that file.[^]

Guidelines for Resolving IIS Permissions Problems[^]
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