views:

718

answers:

9

Hi,

I'm looking for a framework which allows me to manage my application through a webbased GUI (using an embedded webserver) instead of winforms.

Something like this: http://www.webtoolkit.eu/wt but then for .NET

In my code I should be able to instantiate classes (like buttons, forms etc), and when a user browses to a given port, the app should render it as javascript/ajax etc etc. preferably, when buttons are pushed, a notification in my code should be called.

this is a less specific question than another one I posted about extjs. I hope this will attract more viewers since it is more generic

Thanks.


Update:

cassini like solutions don't fit the bill. Since the webbrowser is embedded in my application, there is no need for ASP.NET server side scripts. I would rather have the framework, call functions inside my application when things happen on the page. onButtonClicked() for instance.

A: 

I would suggest going the Linux route instead and rely on something like an embedded httpd, boa, or similar to keep size down. Running Windows is not recommended on embedded systems, too much bloat and too many security holes. Better go with Linux or an RTOS.

jakobengblom2
I dont think he is using an windows on an embedded device...just wants a websever embedded in his app.
Pondidum
+2  A: 

How about embedding Cassinni and using ASP.NET?

Marc Gravell
Hi Marc, Cassini is a mini standalone webserver. I think it won't be very easy to let this communicate with my application. (Apart from changing data via a shared database). Furthermore, I don't like the idea of having a folder full of asp files somewhere which the user might mess up (or hack into).
Toad
Mainly, it shows *how* to host ASP.NET, which you can do yourself.
Marc Gravell
Hi, I think I misunderstood the product (and your answer). This actually looks very interesting.
Toad
When thinking this a bit more over... there is really no need for being able to parse/interpret/execute asp.net pages. It would be much nicer if the framework/webserver calls into functions in my application.
Toad
In that case, use the HttpListener approach (Rune) - but note that it can quickly get complex. A bit like writing all your web pages in an ashx page.
Marc Gravell
+2  A: 

You might use the System.Net.HttpListener class as an embedded webserver. The HttpListener will do the low-level stuff for you, but you will have to write the code that returns the Html/javascript/images yourself.

I tried it out just for fun myself, embedding firefox using GeckoFx against a web server embedded in the application itself. It seemed to work well, but my test was very simple and limited.

Rune Grimstad
Hi Rune, I have been playing with this option. I like it that httplistener gives a very easy way to handle incoming http requests.Somehow converting a application GUI to output in it's javascript/html counterpart, and handling the ajax requests, is quite an undertaking though.I was hoping someone already made something similar. ;^)Nice project to work on though. I agree.
Toad
Oh yes! Getting it to run is one thing, but making a complete application out of it will be a huge job. If you ever do get it to work properly you should blog about it or post the code somewhere. It would be interesting to see how it works. :-)
Rune Grimstad
Dude, +100 for casually throwing the GeckoFx link in. That thing looks to be The Bomb! Thanks!
Dan F
Hehe. Yeah. It works well, but it is a pain to setup the first time.
Rune Grimstad
A: 

If you want to automagically convert running WinForms code to HTML, you're already in deep water. I have done something similar with Visual WebGui, but it does require modifying your code and will basically generate an ASP.NET application for you -- needing an actual web server to run it.

I see you don't like the Cassini option -- if you also expect this to work without a web server, then I think the quick answer is "no way".

If you have a relatively simple interface, I think your best bet is probably to generate the HTML code dynamically, either from your existing forms or from scratch, and go with System.Net.HttpListener.

Tiberiu Ana
this is what webtoolkit does (rendering the html/javascript dynamically) although not for .Net. I was hoping something prebaked was available somewhere for .Net. Hence my question
Toad
A: 

I did a long time ago, a .NET 2.0 project which basically had a Webbrowser control.
I would feed the WebBrowser control with html through it's Document properties, and would listen to the navigate event, in order to grab the Html from my resource (or build it instantly) and feed it again to the WebBrowser control.

Now the fun starts with the ObjectForScripting property. This allows your html page to talk to a .NET object through Javascript like: window.external.SomeNetFunction(bla).
Don't forget to add the ComVisible attribute to the class that is used in ObjectForScripting.

I hope this is what you are looking for. In this solution you have a webpage which can navigate, and also via javascript can talk with your app. (like this you can come close to a .NET version of AIR...)

Gidon
Hi Gidon,this would mean that the webcontrol is embedded into the application. However, the reason I want a html interface is that my app can be controlled from a remote location
Toad
+1  A: 

If you could use ASP.NET (using development server or cassini) then your task would be simpler. I strongly recommend this approach. In this case you could use liveui, componentart or teleric. liveui provides Extjs based framework to implement 3-tiered web applications. componentart and teleric provide nice ASP.net controls.

Whereas webui probably can work as httpHandler without ASP.net infrastructure. But I would not recommend to use webui because 1 potential performance problems 2 complex and not flexible programming model.

Alex Ilyin
+2  A: 

You can host the ASP.NET runtime in your own application and use any web UI framework like LiveUI or something like this. See how to do this here.

Alex Kofman
Hi Alex, having asp.net in my application seems like overkill, since my application is already made in c#.In stead of serving aspx pages, I'd rather have the embedded browser call methods in my app directly.Furthermore, preferable I don't have to know anything about html/css/JavaScript. Just instantiate some buttons, labels, etc in my application, and magically generates the corresponding html/javascript and delivers in application callbacks via ajax.the result: a remote gui for your application.Would even be sweeter if it somehow could interpret your existing winform gui.
Toad
There are many frameworks, that allow you to know nothing about html, JS and css, and create rich web UI (it looks like this http://wiki.liveui.net/index.php?title=Editor_and_Form_concept ). The problem is that all of them are designed to work with ASP.NET. Since ASP is just a part on .NET framework, there is a chance that you'll be able to use it in your application.
Alex Kofman
+1  A: 

Are you limited to what framework your application can support? If you can use .NET 3.0+, The Windows Presentation Foundation can be used to target both web (via xbapp or silverlight) and traditional windows form applications.

As far as communication between apps goes, this is where the Windows Communication Foundation (WCF) really shines.

Just to clarify, you could use Casini host your web app and use the WCF to communicate between it and your application, or use xaml to markup your application and expose it as both a web application and a normal windows application with the same UI.

Timothy Strimple
A: 

DevExpress have a product that does what you require. You'll have to fork out for it though...

http://www.devexpress.com/Products/NET/Application_Framework/

Nathan Ridley