Hosting ASP.NET within my application

I had a wild thought today. I’ve been discovering that my users like my web UIs more than my WinForms UIs…but there are good reasons to still write a ‘smart client’ application.

Can I write my application UI in ASP.NET/MVC, host it inside my client exe, and locally access it using the IE control in my winforms app?

Is there a lightweight server I can host in-process or fork off? Has anyone tried this? Did the results flatter?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can use the Cassini web server.

3.5 download:

v2 download:

Method 2

Yes, short answer: get the source for Cassini and it shows you how to host the web server.

I’ve used this technique to host web services (*.asmx). When the application is online, it can connect to the internet and use a web service there. When it’s offline, it uses “localhost” to connect to it’s local instance of the web service. This way you only need to write one data access layer.

Method 3

I think a wild thought is a understatement 😉 I strongly urge you to consider if there isn’t something you are missing, if there isn’t a better solution but here it goes…

There is such a lightweight server. It’s also being used by visual studio for developers. It was originally called Cassini which uses System.Web.Hosting (a low level API for creating a http server and hosting the process)

Method 4

Though late to the party, check out the C# webserver

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x