简体   繁体   中英

launch console application from asp.net page on shared hosting

i need to launch simple console application from my asp.net webpage, that creates a file using given parameters. hereis my code:

string filePath = Server.MapPath(@"~/Patcher/TestPatcher.exe");

System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath , "-sn:123456789123456 -upd -fn:test.hd");
info.UseShellExecute = false; 
info.RedirectStandardOutput = true;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);

p.WaitForExit(25000);
// Display the output
string str = p.StandardOutput.ReadToEnd();

problem is that program doesnt create any file, but it does launch - i got some output in "str". any suggestions? and btw, that website must work on shared hosting.

Yeah. I think you have a security issue there... you can't just run an exe from a sandboxed environment (which the browser is).

Besides the code snippet you provided, is trying to run code on the webserver, not on from the asp.net page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM