Executing command line from ASP.NET

A

arc

I have a requirement in executing a command line from Web Application, it
does this in the background and doesnt display the results to the user.
But i dont think the Web environment in .NET allows this to happen without
some security tweaks. How can i do this? Same code with Process.Start works
fine in Win Forms.

Have tried changing security permissions to the file/directory and stuff.
What needs to be done?
Since i have full control over the server i wouldnt worry much about putting
the server at risk at this point. Advice please.

Thanks
Arc.
 
M

Martin Dechev

Hi, Arc,

Did you try using your existing code? The one that you use in the WinForms
application, that is. Do you get any exceptions?

Anyway, most probably you will need to impersonate some user with more
rights than the ASPNET or NETWORK SERIVICE users. Use the following article
as reference how this can be done:

http://support.microsoft.com/?kbid=306158

Hope this helps
Martin
 
A

arc

Hi Martin,

I have tried working on this based on the article, still doesnt seem to like
it.

1. Have used <identity impersonate="true" />
2. Did this - Change the account that the Aspnet_wp.exe process runs under
to the System account in the <processModel> configuration section of the
Machine.config file.
3. Tried this - Grant the "Act as part of the operating system" privilege to
the ASPNET account (the least privileged account).

Still doesnt execute even a simple IE or Notepad.exe, here is the code i use
that opens up perfect with Windows Forms application.

/********************* Process execution code
***************************************/

System.Diagnostics.Process myproc= new System.Diagnostics.Process();
Process.Start("IExplore.exe", www.microsoft.com);

/********************* Process execution code
***************************************/

When run with Web App, the target executable runs in the process but doesnt
show up or execute.

What could be the problem?

Regards,

Arc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top