i have a web application in which i want to execute an .exe file.
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = this.WorkingDirectory;
when i put my
info.WorkingDirecoty = Request.MapPath("~");
info.FileName = Server.MapPath("~/theFile.exe");
it works. But when I put them like this:
info.WorkingDirecoty = "~";
info.FileName = "~/theFile.exe";
it doesnt work, why ?? and how can i solve this problem ?? or should i always use the Server.MapPath???
As MSDN says
and you need to give direct file path to ProcessStartInfo
So you should use Server.MapPath in this case
If you don’t want to use Server.MapPath because of reference to System.Web you can create a BaseDir property in that library class, and pass it from out world where you have reference to it.
Hope this helps.