简体   繁体   中英

process.start from ASP page, where to put exe file

Just a quick question, where do I put the exe that I am trying to launch in an ASP project? It cant see it in the bin folder.

You need to pass a full path to Process.Start :

Process.Start(Server.MapPath("~/bin/whatever.exe"));

However, ~/bin/ is meant for .Net assemblies; it's generally better to put external EXEs in ~/App_Data/ .

Note that you can only execute programs on the server, not the client.

Remember that your Website is running on a server so if you Shell anything (Process.Start in an ASP.Net application) it will be opened on the Server - not the Client PC.

Be sure you test this in production and when you do shell processes on a server (which I would not advise) dont forget to close them, otherwise you will end up with strange errors on the server.

To avoid security concerns and multiple process running in parallel. from asp page i would rather prefer to queue up the request for process start in some table than have other process like windows service in background to pick it up from queue and execute.

Path.Combine(Server.MapPath(Request.ApplicationPath), "PathToExeFromWWWRoot");

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