Running External Applications in ASP.NET

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

I'm trying to execute an application on the server side in
asp.net. For a simple test, I wanted to run notepad.exe
which I copied from the windows directory to my web app
directory. Here's the code snippet of my webforms
page_load event:


Process myp = new Process();
myp.StartInfo.FileName = "notepad.exe";
myp.StartInfo.WorkingDirectory =
@"c:\inetpub\wwwroot\loanimporttool";
myp.EnableRaisingEvents = true;
myp.Start();

everytime I run this, Notepad runs on the background but
the window doesn't show up. If you try to run the same
code in a windows app, it works. What am I doing wrong?
Any help would be appreciated. Thanks!
 
The process will be running under the ASP.NET worker account identity, which
will be different to the identity of the logged in user, and by default will
not have access to the window station of the current user. The .NET
ProcessStartInfo does not expose the lpDesktop parameter of the Win32
STARTUPINFO structure that allows a process running under a different
identity access to use the window station of another user.

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org
 
Back
Top