I have a portion of code like this:
Process proc = null;
try
{
proc = new Process();
string dir = HttpContext.Current.Server.MapPath("~/Other/");
proc.StartInfo.WorkingDirectory = dir;
p.StartInfo.FileName = "batch.bat";
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
}
catch (Exception e) { }
It will only work if I replace "dir" with
string.Format(@"C:\AbsolutePathHere")
Why?
edit: The code works in a button click event handler. It doesn't work when it's a scheduled Quartz.NET job. It always works when I have the absolute path. So my question is probably: How do I make Quartz.NET and MapPath play nice?