How can Process.Start() command be used in a Web Application??

B

bwalke

I was wondering if and how the Process.Start() command can be used in a
VB.NET Web Application. I want the client side to invoke an .exe
application by clicking a button and I want the .exe to run on the
server side. When the button is clicked the .exe does not run and the
process fails. I have used this Process.Start() command in a Windows
Application before successfully. I have read in groups that it is not
possible to use Process.Start() and also have heard that it is possible
in Web Applications. I also seen stuff about impersonating a user to
run the .exe, does this have to been done, any good quick ways to go
about this. Here is what I have tried so far in the web app with no
luck...

Dim myProcess As New Process()
myProcess.EnableRaisingEvents = False
myProcess.StartInfo.WorkingDir­ectory =
"C:\NETProjects\test\AppTest\b­in\"
myProcess.StartInfo.FileName =
"C:\NETProjects\test\AppTest\b­in\AppTest.exe"
myProcess.Start()

Also have tried this...

myProcess =
Process.Start("C:\NETProjects\­test\AppTest\bin\AppTest.exe")

Any Suggestions would be great!!

Thanks,
Brett
 
G

Guest

You have a couple of choices I can think of off hand:

1. Wrap the funcationality in a service that can accept calls from your web
app. This approach is inherently more secure, but requires more programming
to get it up and running.

2. Allow the ASP.NET user (ASP_NET, or NETWORK_SERVICE if Windows 2003) to
have access to the executable. This is a potential security hole if you have
not locked down the page that fires the EXE.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
B

bwalke

How can you go about assigning the Network_Service 'user' access to run
an .exe file. This user is not listed in the User Group. Also, is
there a way to assign Network_Service to the Directory Security in IIS
for the page that is going to trigger the .exe file.

Thanks

Brett
 
A

Alvin Bruney [ASP.NET MVP]

what exactly are you trying to do?

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 
B

bwalke

I want to run an executable file on a server which is located on this
server and I want to have it triggered by a user from an intranet web
page.
 
A

Alvin Bruney [ASP.NET MVP]

roughly
using(System.Diatnostics.Process myProcess = new
System.Diagnostics.process()
{
myProcess.StartInfo.FileName = @"cmd";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.Start();

StreamWriter sIn = myProcess.StandardInput;
sIn.AutoFlush = true;
StreamReader sOut = myProcess.StandardOutput;
sIn.Write(" executable followed by command line args");
sIn.Close();
myProcess.Close();
}

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 

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