> This is a re-post of an earlier problem which I have not been able to
solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
[snippage]
The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute
I have tried the same code in .Net Windows VB and WinApp.exe executes.
There apparently is some difference in launching from a Web app that I
haven't been able to figure out.
heh. I get to write a "Dear John" letter:
I don't have empirical fact here, but I bet your WinApp.exe really is
executing.
I played (hacked, really) around with this a little bit and to me, it seems
like ASP.NET and COM+ EnterpriseServices both show the same behavior:
The launched application launches and remains in memory as if it is waiting
for a user to interact with it, but displays no UI. I don't know of a
solution, but as far as I can tell, that's what's happening. I would
recommend experimenting with calling a console application like PKZIP and
see if you can make it actually zip files, or if the process just loads and
hangs. If it actually does what it's supposed to do even without a UI, I
think you're OK.
Remember that ASP.NET has been designed so that stuff running at the server
can run without user intervention because at the web server, there is
probably not anyone looking at the screen. There is probably not anyone
even logged on at a server. So stuff that is designed to run on a server
can't have a UI.
You can also see this behavior in VB 6. If you make an ActiveX DLL in VB 6
that has a method that throws a MsgBox and compile it with the "unattended
execution" option, the MsgBox will run, but not on the screen, and you'll
see an item in the Application Event Log that describes what the MsgBox
*attempted* to display.
IMHO, you should not be launching user-interactive applications from ASP.NET
or from COM+. If you really want the user of your web application to be
able to launch this other application, try to find a way to do it
client-side, from the browser, like by using an ActiveX control that
provides the UI (remember, there's nothing stopping you from writing a WHOLE
program as an OCX, forms and all!), or by using .hta instead of .htm to be
able to run with full trust so that it can launch the other application.
A word about the ActiveX control idea: If you try this approach, be
*extremely* cautious about how you design it. If you give it a property
like "AppToLaunch" then it gets webified like this:
<object ....>
<param name="AppToLaunch" value="WinApp.exe">
</object>
Then you introduce a dangerous security threat because if I were a badguy, I
could get *your* control to run *my* app that is written to do all sorts of
horrible things.
Also, since launching one application from another *always* implies a
potential for security issues, have a chat with one of your network admins
about what you are planning to do; be warned in advance, your network admins
will sound justifiably paranoid about this. :)
--
Peace & happy computing,
Mike Labosh, MCSD
"SELECT * FROM Users WHERE Clue > 0"