Shell a windows app from web app (using latest versions of .NET?)

Is it possible (or even advisable) to shell a windows app, from a web app page?   Can I do this without using ActiveX controls (that is, is it something as simple as a code permissions issue)?  

I need something that could be deployed in a production environment; a well-thought-out method.

- Using .net framework 2.0 - 3.5 (all are installed in my target environment)
Who is Participating?
Ted BouskillConnect With a Mentor Senior Software DeveloperCommented:
Well to be honest this is an intrinsically difficult task to solve and I have first hand experience trying to solve it.

My last employer had the exact same requirements.  However, before I was hired they actually implemented a custom application that was deployed on all clients to do this without a browser.  They used a LanDesk type application to push binaries out to clients as well as a Group Policy in the domain to maintain other settings.

A browser plug-in is another valid choice (that's how Macromedia, Adobe and Microsoft trigger remote installs)

I've prototyped the smart client and it actually works quite well.

Gary DavisDir Internet SvcsCommented:
If you mean can you click a link on a web page to run a windows app on the client's PC the answer is no. This is a security issue and if it were possible, it would be a nightmare (virus/trojan infections, data theft, etc). ActiveX you mentioned would be one way but user would have to agree to let it be installed and then run it.

If you mean to run an app on the server, it is possible using System.Diagnostics namespace, but I think you are asking about the 1st case.

Gary Davis
Ted BouskillSenior Software DeveloperCommented:
If you need a web application to trigger execution of operating system executables the safe way is to flag requests in a data source then have a windows service that is polling the data to initiate controlled application processes.  I've written applications exactly like that but it was tightly controlled so that the servers were not at risk.

IIS is specifically designed to protect the hosting operating system and your question is asking how to circumnavigate that protection.
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

nespaAuthor Commented:
Let me also add -- I have full control of the desktops that are accessing this control (essentially, a link on a webpage), and it's on intranet (yes, very important & should have mentioned this).

So I have "explicit permission" on desktop (that it allows an exe to be run by webapp) and also webapp itself; can install anything I need in the webserver (including any IIS security... for example, if need write access to a dir. on webserver, can do that).

My initial thought was right along the lines of what you both mentioned - circumvents necessary security restrictions & not a good idea.  

However with intranet & ability to install anything I like on webserver/desktops, can this be done in a "safe" manner (at the high level, I let the .net/iis process trust the desktop app)?

Thanks for considering this request & helping me with ideas.
nespaAuthor Commented:
rather... implicit permission.
Ted BouskillSenior Software DeveloperCommented:
So you want an intranet user to trigger an application on the server?  Well why don't you setup a file share that the intranet users have access to and then expose the file share with a UNC link on the web page.  The file share could be a batch file that triggers the executable to run on the server.
nespaAuthor Commented:
tedbilly - we're close -- is it possible to get the executable to run in the client's process?   so technically we have:

1) User on local PC, connected to intranet
2) Opens intranet page in browser
3) Clicks link on page
4) Link causes (local process) to shell (local executable)

...that's exactly what I'm looking for; to open in client's process/space.  

Maybe I should have asked "can IE open a local app?", with the understanding that we have FULL access to what's installed on each desktop so we can make assumptions such as app location will not change:

C:\Program Files\MyCompany\App1\start.exe

And, I may be answering my own question (as to the best way) but possibly install a plug-in in IE (much like other apps which are implicitly trusted like Flash plug-in).   That plug-in could start the app in the above folder, I'm assuming switching the context to the client's process.

Anybody -- am I on the right track with this?  Has anyone gone to great lengths in the past to construct something like that?  

maybe there's the possibility of setting code permissions on the EXE on the client, giving the IIS process access to it.

I'm still searching for the best way to do this - I appreciate any help if the ideas above are making sense.   Thanks.
Ted BouskillSenior Software DeveloperCommented:
Wait a minute, you mean you want the binaries to execute on the users local system?  If yes then all you need is what Microsoft calls a 'Smart Client'

Basically it runs a windows application locally and updates the binaries automatically as you upgrade the application.  The basic idea is that the user clicks a link that downloads a stub EXE that then interacts with the remote server to execute the application including automatic upgrades.

It's not a good choice for the internet but in an intranet it should work fine.
nespaAuthor Commented:
tedbilly - thanks for the help on this:  I know this question is asked OFTEN, and varies by context/ solution.

I did consider smartClient... however it's tricky:  SMS is already used to update apps at this they already have structure in place to support versioning of app, downloading, etc.   they'd like to stick to that structure, and we as a devTeam would like to respect it:  build windows client as per bus. reqs., then allow them to keep updating via SMS as necessary.  

In my experience building a smartClient requires that extra structure you mentioned (stub EXE, keep binaries on server which is actual "meat of the app", etc.) so...i didn't want to build that structure simply because the client /bus. reqs. NOW dictate "hey, we'd like to be able to start the app from within the browser on intranet".

so i was hoping to find something much simpler than creating smartClient structure to support the ONE FUNCTION that they now would like to see:  shelling local app from browser.   :\

final thoughts?   your smartClient is probably the best way to do this (or maybe browser plugin which has permission to shell app) i'll award the points after hearing back; just want to make sure i've exhausted the options / tried to figure best solution out.

again, thanks for back & forth on this: it's been driving me crazy that such a simple little request can be so tricky...but it was the decision to go with windows client and i'm trying not to change to web app, just to fulfill this one request.
nespaAuthor Commented:
Good - this resonates w/ what I figured was true; it's not an easy thing to do just yet.

Last, I'm going to look into OneClick deploy as I figure that's the latest SmartClient-based solution in the Microsoft world.

Thanks much for your help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.