Shell() fails in web application

eXJey

New member
Joined
Dec 15, 2008
Messages
2
Programming Experience
10+
Hello

I am using the Shell function to execute an exe program, from server-side code of course. The call fails silently in a strange way. The EXE runs fine when i am double clicking it from the Windows Explorer. I even trying to run "c:\windows\notepad.exe" and the notepad starts but somehow with no interface, it just appears in the windows task manager as a process taking no cpu usage.

I feel that is something about rights and permissions. I've already tried to give to the exe access to the ASPNET user, even full read/write permissions to the entire directory, but still the same.

Shell fails silently. No trappable runtime error. Feel free to reproduce the problem by creating a new vb.net web application and run a program (exe) via Shell in the Page_load event. Please help.

p/s
- Diagnostics.Process.Start fails too.
- The exe program i am trying to run has no visual interface.
- The server runs WinXP Pro and asp.net is 1.1 (vb.net 2003).
 
Last edited:
First up, don't use Shell at all in VB.NET. Use Process.Start to start a new process.

Second, starting a new process on the server in response to a user action on a web site is not generally a good idea.

Finally, the call is not failing at all. You're starting the process from an ASP.NET application so it runs under the ASP.NET account, not under any other interactive user that may be logged in at the time.
 
As I said, Process.Start has the same behavior.

To call or not en external EXE (some process) is absolutely neseccary. Not all web pages are pages with beautifull visual contents. This page must do some serious file operation and ask some critical data from other LOCAL machines on my network. That EXEs cannot be reproduced in the asp.net code. Its impossible. So, the idea is to use the web app interface and run in a page_load event the EXE (which acts actually as a code-extension, nothing more or less) and return the result to the client user via a browser.

The server is private and the client is inside the LAN only.

Any ideas on how can I make the ASP.NET run the executable without that problem?

I can sure you that the EXE i am talking about, does NOT run at all from within the shell (or process.start). Its ASP.NET problem. From the Windows Explorer, runs OK when I am double-clicking it. Nothing wrong with the exe. It does some file opening and then ends it self. But the ASP.NET I dont think that needs to know what the external program does. I want just to run it.

Even if it is a wrong idea or not, there must be a solution. Otherwise why the Shell or Process.Start methods exist in web applications?
 
Back
Top