-2

I have a web application that is built with:

1- Backend is ASP.net MVC 5 (C#)

2- Frontend is HTML 5, a CSS3 framework and jQuery

I want to change it to an executable that I can give out to my users. I've been looking around and I found that WPF supports WebBrowser control

<WebBrowser Height="200" Name="myWebBrowser"></WebBrowser>

I assume this is somewhat of an IE shell? as my application works with IE, Will this work for WPF? I need to be able to reference CSS classes, and JavaScript functions like you would do in a normal browser. Inline HTML/CSS will not be enough.

If WPF is not the way to go, is there any other way I can achieve this?

RonaDona
  • 912
  • 6
  • 13
  • 30
  • To the ignorants downvoting, as I said, it is OK to be ignorant, in technology, there are always ways to do things that you would think are unconventional, but turn out to be possible. I posted this question so myself and you can learn. If you keep downvoting, you will stay ignorant and I do not want you to. Ignorance counter above to catch more morons? ^_^ – RonaDona Oct 02 '16 at 05:54
  • *I want to change it to an executable that I can give out to my users* Why do you want like this? – Divyang Desai Oct 02 '16 at 05:55
  • @Div, it is because the application asks for their credentials and I can not do this in a web form on their behalf (not allowed to). The tool has to run on the client side, and as it is built with C# and a rich UI, WPF was my first thought. Now that you know why, I hope that you can help. – RonaDona Oct 02 '16 at 06:00
  • What if you convert your web application to an executable file. Read [this](http://stackoverflow.com/questions/19288927/create-exe-from-mvc-application) It may help you! – Divyang Desai Oct 02 '16 at 06:03
  • @div, using mono xps is not a bad idea actually, I will give it a try, thanks! I will also spend more time with WPF WebBrowser control and see if it works, and will update this question (if the idiots downvoting do not get it deleted of course) – RonaDona Oct 02 '16 at 06:11
  • 1
    OK, and *Will this work for WPF?* You mean that "Can we run WPF application on browser like IE and else" isn't it? – Divyang Desai Oct 02 '16 at 06:13
  • @div, this: https://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=vs.110).aspx It seems I can only have a single file (so cannot really reference CSS and JS libraries. But my idea for now is to try to make it all in one html page and use – RonaDona Oct 02 '16 at 06:18
  • 1
    You can go trough it, if your application has small size otherwise it'll more complex to handle it in a single page as you know. And for that you have to create `WPF Browser Application` and may be you can add external css and js files into it, not sure. Refer [this](http://stackoverflow.com/a/13119789/4753489) And [this](http://stackoverflow.com/questions/4029602/how-do-i-add-a-local-script-file-to-the-html-of-a-webbrowser-control) – Divyang Desai Oct 02 '16 at 06:30

1 Answers1

1

In general, ASP.NET MVC builds server-side web applications and needs be run on a web server such as IIS or Apache/Mono. If you developed in VS.NET, you used a built-in web server integrated with VS.

That is

  • if you want to create a client-server application with a client (desktop EXE) and server part (ASP.NET MVC) then, yes, you can use WPF or WinForms to build the desktop part that will open the server part in the WebBrowser control.
  • if you want to get rid of server part and port classic MVC application as-is to WPF, in general you'd need to change the code. See Is WPF and MVC same concepts? or tens of other similar questions here.

It's not clear what your application does and why you decided to build a client application instead. If let's say you read and display some data from the database then you could potentially port the application to WPF/WinForms with WebBrowser control but you would need to rewrite all your Views that display data.

Community
  • 1
  • 1
user2316116
  • 6,726
  • 1
  • 21
  • 35
  • ok let me paraphrase my question, I want to build an exe with a rich GUI that is rendered using HTML, CSS and jQuery. Forgot about the ASP.net part, I know that I'd have to rewrite/move my logic. My questions is, what are the WebBrowser control limitations? does it support everything IE supports? and if it was limited, is there any other way I can achieve this in a better way? – RonaDona Oct 02 '16 at 08:15
  • 1
    Yes, it uses IE's rendering engine and supports all what IE does. http://stackoverflow.com/questions/1495944/webbrowser-control-limitations – user2316116 Oct 03 '16 at 08:03