Does 'Shell' work from a web page?

Codeless

Well-known member
Joined
Jan 24, 2003
Messages
59
Location
Great NW
When I run a shell command from my web project (say with a button click from a web page) like...

Code:
Shell("c:\myapp.exe", AppWinStyle.NormalFocus, False)

The window never comes up, even though I can see that the process is running on Task Manager. AppActivate doesnt seem to help either. Is this a Windows function only?
 
You can simply provide the link (path) to the exe on the server in an <a href>. (it can be contained in a Label or Hyperlink control)
 
Thanks I think that will work ok for what I am doing, but what is the syntax for sending it a parameter? For example if I have a filename on my webpage in a text or combo box that I want to load into the executable, what would be the syntax? The following doesnt seem to work.

<a href=c:\WINNT\notepad.exe myfile.txt>

As another side note I also found the process.start method which also seems to work fine in a windows app, but not a web app. Why would this be the case since isnt it all just VB anyway?
 
process.start works fine for me on a web page. What does you code look like?

Instead of this...<a href=c:\WINNT\notepad.exe myfile.txt>

You should do this...../myFolder/myfile.txt> (this would be the location of the text file on the server)
 
Looks like this...

Code:
Dim myproc as System.Diagnostics.Process
myproc=New System.Diagnostics.Process()

myproc.Start("c:\WINNT\notepad.exe", "c:\testfile.config")

When executed I can see a notepad process running but I cant see the window anywhere.
 
I guess I should also explain that the executable that I will ultimately be running is not notepad. I have an executable that was created in VB6 that I dont want to convert to .NET because it works just fine as it is. I just have to pass it a parameter that comes from a selection on the web page which will then do some other processing on the server directories. Thanks for the help.
 
Anyone want to venture even a guess? Been dealing with this for 3 days now. Latest thing I tried was to impersonate the admin user while running the web and no avail. I can still see the process is running, but cant see the window. Very strange...

Ive tried it using a windows app, and it works flawlessly.
 
Notepad, if launched from an ASP.NET page will run under IIS local user account, meaning that you wont see any windows or be able to communicate to the process from the account youre currently logged into. Windows will be displayed on the desktop associated with that account, not your desktop. The only indication youll see is the process details in Task Manager, since all processes on the local system are displayed there, regardless of the user account theyre running under.
 
Thank, that makes complete sense to me now. That is a whole paradigm shift for me. I come from a background of VB6 and have never done any ASP. Now that Im programming ASP.NET, and the look and feel is that of classic VB6, it seems that everything should work the same as well. But alas I have to keep in mind that Im not programming apps anymore, but web sites and web services. Which for me is a whole new concept. Thanks for your patience. Ill get there.
 
Back
Top