For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > November 2005 > How do I start a local application from within a web form?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do I start a local application from within a web form?
Phillip N Rounds

2005-11-29, 7:03 pm

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();






Charles

2005-11-29, 7:03 pm

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

Charles

2005-11-29, 7:03 pm

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

Juan T. Llibre

2005-11-29, 7:03 pm

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/...n-us/runas.mspx

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






Juan T. Llibre
ASP.NET.FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaņol : http://asp.net.do/foros/
======================================

"Phillip N Rounds" <prounds@cassandragroup.com> wrote in message
news:eqL5wgT9FHA.648@TK2MSFTNGP12.phx.gbl...
> 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();
>
>
>
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com