How do I start a local application from within a web form?

P

Phillip N Rounds

What I would like to do is to have a console application on my server
started when a user performs a specific action on a web form. Specifically,
MyConsoleApp overwrites an existing file with updated info.
MyConsoleApp.exe works just fine and I believe the codewhich calls the
MyConsoleApp.exe (below) is correct. This process fails, with an error:
Access is denied
User Account MyComputer\ASPNET

This makes sense, my computer shouldn't permit an unknown user to write to
my disk. Do I have to create a user account ASPNET and give write
permission in the appropriate directory to this user?
Is trying to do this such a horrendous idea that I should find a different
approach?


Thanks

Phil

I have the following in an appropriate place in my web form:
System.Diagnostics.ProcessStartInfo ProcInfo = new
ProcessStartInfo("c:\\MyConsoleApp.exe", null );

ProcInfo.UseShellExecute = true;

System.Diagnostics.Process Proc = new Process();

Proc.StartInfo = ProcInfo;

Proc.Start();
 
C

Charles

add the ASPNET user to the permissions of the folder. Give it read and
write and you should be good to go
 
C

Charles

By the way, the username ASPNET already exists by default, the user
that is used can be set in the machine.config
 
J

Juan T. Llibre

re:
Do I have to create a user account ASPNET and give write permission in the appropriate directory
to this user?

IIRC, you need to run the process with an account
that has permission to access the directory's or file objects.

Look into running MyConsoleApp as ( using runas ) the ASPNET account
(if you gave the necessary permissions to the ASPNET account)
or as any account you want to, as long as it has R/W/M permissions
to the directories/files you need to access/modify.

See :
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx

Probably something like this :
System.Diagnostics.ProcessStartInfo ProcInfo = new ProcessStartInfo("runas /user:MyComputer\account
c:\\MyConsoleApp.exe", null );
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top