tags:

views:

107

answers:

4

I was thinking of creating a desktop application and for the user interface of the application I thought that HTML will be the best option. But I needed some way to generate the HTML for the application from the data structure that it holds.

So I was wondering if it was possible to reuse the ASP.NET engine so it renders the pages but I don't want to install a full IIS server for the users of this application.

So is that possible? Maybe not using the ASP.NET engine, maybe there is a similar one for desktop applications.

A: 

I would recommend 2 options:

  1. Using c# to create a desktop app to host a Web Control. Use C# to process the data into html and feed that as a string to the webcontrol.
  2. Use jQuery to process your data in the HTML page itself.
Ankur Goel
well the question was how to generate that html using a method similiar to asp.net without having iis server installed on the client.i dont want to use stringbuilder for generating the html since i will be basicaly rewriting the asp.net engine if i want advanced features like master pages for example.
Karim
If you need actual ASP.Net features, you can still call the ASP.Net assemblies from a local C# application without the need for a webserver. You'd basically be rewriting portions of IIS that care of managing ASP.Net for you.
Ankur Goel
do u have any references on how to do that?
Karim
+2  A: 

You might be able to use the UltiDev Cassini web server (http://ultidev.com/products/Cassini/) for this purpose. Its lightweight and relatively easy to use.

Are you planning to generate the HTML dynamically, or will static HTML suffice? Don't forget that you can embed the IE WebBrowser control in a desktop app, and then gain access to the DOM from the desktop app code. Lots of interesting things could be done using this approach.

kmontgom
no i need to generate the html dynamicaly. and it will be better if i am able to use the same .asp files that can be deployed to a normal website
Karim
Last time I tried UltiDev, it did take the same ASP.NET files.Another possibility is to download the source for the Microsoft Cassini sample web server (http://www.asp.net/Downloads/archived/cassini/) and actually embed it into your application. You could emnbed the WebBrowser control for the UI and Cassini for web serving. Your app would then become both client and server. How twisted is that...
kmontgom
but as far as i know is that cassini will create a webserver on some random port. it would be better if the app itself will call the render html method and then output the html string so that the webbrowser control is able to display it.
Karim
If you have the source code for the MS Cassini web server then you could conceivably figure out how to directly invoke the rendering logic; specify the name of a ASP.NET page, call the renderer and capture (perhaps as a return value) the rendered HTML. You could then inject this directly into the hosted WebBrowser component. After that you can use jQuery to control the page, and/or allow your host app to interact with the loaded page's DOM.I realize that this might not be an easy task, but it is do-able.
kmontgom
too bad that noone implemented something like that. i think it will be a nice way to create desktop applications with pretty nice UIs
Karim
You're getting into the realm of what I call hybrid apps: the app has characteristics of both desktop apps and web apps. Something like this may be how the future happens. Web apps are great for zero local deployment; desktop apps are great for optimal use of local resources (graphics, compute, etc.). If we could just find out a way of combining the best of both... and I don't just mean Silverlight. Whats needed is a super browser which can use local resources in ways that traditional browsers cannot.
kmontgom
A: 

Your question is about generating the HTML, not displaying the HTML, correct?

You can use the rendering engine from ASP.NET MVC, or even one of the alternate view engines like Spark.

Robert Harvey
yeah but i want to generate the html in a desktop application, and i dont want to insall iis to the users of the applicatio.so is it possible to use the asp.net mvc rendering engine without iis?and what is spark?
Karim
A: 

Adobe AIR supports something like this (build a site using HTML+javascript, but then deploy it as a web application) however it is not going to support the ASP.NET markup.

Frank Schwieterman
i am talking about desktop application without having an iis server.does adobe air supports that?
Karim