Launching Applications from an ASP.NET web application


I recently got asked a question about running GUI apps from an ASP.NET web application, and weather it was possible or not to run GUI apps on the server from a web application.

To give you an idea of what the person asking the question had in mind, they where wanting to run a separate computer as a remote controlled media system connected to a large screen and accessible via a WiFi lan.

something like the following:

After giving it a little thought and trying some ideas involving the “System.Diagnostics.Process” name-space in .NET, I then posted an item on the linked in .NET users group (that can be accessed here – NOTE: you may need a Linked in profile and membership to access)

After a few ideas from Lidnug members, and a little research of my own, I came to the conclusion that if it was possible to launch apps directly it certainly wasn’t worth the effort required for what was essentially a pet project.

I did however get the idea to write my own server that can be controled from a web browser, and that could launch and stop GUI apps from an already logged in session.

After a couple of days coding, and studying the samples provided with the REM Objects internet pack (available here) I came up with an application launcher that uses a REST like syntax for managing applications on the remote machine.

As it stands it works but needs a lot of improvment.

Applications are registered in the applications source code, so you’ll need visual studio .NET 2008 to recompile it if you want to change the applications it controls.  I plan to extend this by making the app configurable from an XML file in the app directory, and I also plan to make this into a service.

If you run the server on a target machine, then connect ot it on port 81 using a browser you’ll get a status page.

From this point on

http://machine:81/<appname>/status - will provide status (not much more than a single line of html at present)
http://machine:81/<appname>/start - will start the app
http://machine:81/<appname>/stop - will stop the app

<appname> (unless recompiled) is 'vlc' or 'notepad' (Without the quotes)

You can download the archive containing the full visual studio project and sources from my MSN Live skydrive Here if you have any comments on it or even want to share your ideas, then please feel free to either add a comment to this post, or find the thread for this on the Linked In.NET users group and post there.

You can also find me on the Lidnug’s main website at http://www.lidnug.org/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s