I have problem with running cmd or exe file from asp.net page.
I used this code:
protected void btnRun_OnClick(object sender, EventArgs e)
{
var p = new Process();
var info = new ProcessStartInfo
{
FileName = Server.MapPath("~/print.cmd"),
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden,
};
p.StartInfo = info;
p.Start();
p.WaitForExit();
}
When I run my web application on VS Development Server everything is ok, but when I deploy this code on IIS (ver 7.5), the code working without errors but nothing happens.
is it possible to run cmd or exe with IIS?
Try:
var info = new ProcessStartInfo
{
FileName = Server.MapPath("~/print.cmd"),
UseShellExecute = true,
Verb = "runas",
WindowStyle = ProcessWindowStyle.Hidden,
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With