2

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 asp.net server I can host in-process or fork off? Has anyone tried this? Did the results flatter?

JoshRivers
  • 9,920
  • 8
  • 39
  • 39
  • 1
    There's really no reason why users would prefer a web UI to a WinForms UI, as there isn't anything you can do with HTML that you can't with WinForms. In fact, there are a lot of things you can do with WinForms UI you can't do with HTML, and getting a little bit of help from a professional UI designer can go a lot farther than deploying local webserver and hosting IE ActiveX. – Franci Penov Sep 02 '09 at 00:53
  • Franci, while strictly speaking what you say is true, I have trouble believing that you can write an interface that reflows and resizes with different window sizes and font preferences as EASILY in winforms as you can in HTML. They layout engine just doesn't support such things. Not every problem is a nail. – JoshRivers Sep 02 '09 at 20:30
  • Franci, when you say there is no reason to prefer Web to WinForms, you need to realize that preference doesn't have to be based on logic or features. It can be based on intangibles as well. It might be more familiar to them, or simpler, or any of a thousand reasons that have nothing to do with functionality. – Andrew Lewis Oct 14 '10 at 15:17

4 Answers4

4

You can use the Cassini web server.

http://www.asp.net/Downloads/archived/cassini/

3.5 download: http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx

v2 download: http://blogs.msdn.com/dmitryr/archive/2006/03/09/cassini-update.aspx

Jim W
  • 4,890
  • 2
  • 20
  • 26
1

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.

Blue Toque
  • 1,775
  • 13
  • 24
1

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 asp.net process)

olle
  • 4,597
  • 24
  • 28
  • You know, you're right. I really don't need the ASP.NET engine to achieve my goals. It would be better to give static html and javascript to the IE control, and then use ajax within the static page to communicate either with a WCF service or by direct DOM/js interop http://stackoverflow.com/questions/305915 http://www.west-wind.com/WebLog/posts/493536.aspx – JoshRivers Sep 02 '09 at 20:45
0

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