13

I have a win form application and i'm trying to run it inside the web browser,i rummaged through web and found some links:

I tried this link:Embedding a .NET WinForms Application in an Internet Browser Using WPF ,this works fine but the problem is that the end-user has to install dot net frame work for running the application.

I found another link here for running a WinForms Application Inside Web Browser,with Visual WebGui development framework.

Has anyone had any experience with WebGui?

KF2
  • 9,887
  • 8
  • 44
  • 77
  • Visual WebGui is no longer in development/support: The only place to find it until Codeplex dies is here: (https://archive.codeplex.com/?p=visualwebgui) – RJ Kelly Mar 23 '18 at 19:11
  • it's possible using WASM and MONO and someone did it. https://github.com/roozbehid/WasmWinforms here is an example https://webassembly.z19.web.core.windows.net/ it works on linux without .net – Erfan Azhdari Aug 08 '19 at 09:03

6 Answers6

12

Well, Visual WebGui is web over ASP.NET. Its developing experience is the same/similar to that of Windows Forms using the Visual WebGui designer integrated into Visual Studio. You do your code behind just the same as you would on Windows Forms and the WebGui runtime transforms it into HTML5/CSS/JS.

The efforts needed to convert your Windows Forms application to a equivialend Visual WebGui web application will depend on the (3rd party / .NET) components used in your Windows Forms application. The Visual WebGui API is farily similar to that of Windows Forms, so in some cases you can add a few references to WebGui specific assemblies and then to a search/replace for a couple of namespaces. There are of course some differences, as these are two different platforms, but the developing experience is quite similar to Windows Forms.

Palli
  • 191
  • 2
0

winforms is not web. Web is Web.

Web means HTML + something (usually JavaScript, CSS and probably jQuery or such).

1 - If you need a web application, and want to do it with .Net, create an ASP.Net Application.

2 - If you need a Windows application (Desktop), create a WPF application.

3 - If you need a Windows 8 "Metro" style application (a.k.a Windows Store App), create a WinRT XAML application.

4 - winforms is completely useless. Forget that.

If your customers don't want to install any version of the .Net Framework, your only option is #1.

A winforms application will NEVER be a web application, regardless of any hacks you do to make it run inside a web browser.

an XBAP (WPF Browser Application) is also NOT a web application. It's just a regular WPF client application that does not have it's own window.

Edit:

If you did things the right way (that is, maintaing separation of concerns and putting application logic in Controllers or ViewModels instead of the horrible code behind practices most winforms developers are generally used to), It should not be that hard to reuse your application logic and create a new application (web or otherwise) while maintaining the Data Access and Business Logic layers intact.

Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154
  • 2
    exactly i know this! i just want to ask have any one experience with WebGui? – KF2 Jul 18 '13 at 19:39
  • @Irsog I have no idea what that is, nor do I care. If I need web, I go web, otherwise WPF. there's no reason to use obsolete winforms stuff. – Federico Berasategui Jul 18 '13 at 19:41
  • i have an winform app.i could run i with wpf browser app as hostelement,that work fine but user must install .net,so i have not enough time to write same web app,i see WebGui form design is the same as winform app,i need to know can i copy my form to WebGui app without modification. – KF2 Jul 18 '13 at 19:45
  • my code i mostly separate from view,finally i have to make an UI for web and so on...+1 because there is no convenient way to do this:) – KF2 Jul 18 '13 at 19:55
  • 4
    Just curious - why is this marked as the answer when it doesn't directly address the question, and an answer below which does directly address it is not and has been down voted? It's an interesting comment and worth reading, but doesn't seem to be an actual answer. – David Wylie Apr 01 '15 at 11:39
  • 2
    I recognize that WPF supersedes WinForms and is more powerful. But WinForms is FAR from useless. That's like saying, today, use UWP because WPF is useless. – Ronnie Overby Oct 22 '16 at 00:48
  • I think this answer is accepted by mistake, because it does not even try to address the original question. I think OP already knows the difference between web and desktop applications. – George Polevoy Jan 25 '17 at 12:46
  • What if there is a 20 years old legacy code used by clients already with large amount of code that is not a easy porting to a new web project? – GamaSharma May 10 '18 at 17:57
  • @GamaSharma winforms did not exist 20 years ago. I don't understand your question. Anyway, Microsoft announced yesterday that you can now host UWP content inside an existing win32/winforms/WPF app. So there is that. – Federico Berasategui May 10 '18 at 18:13
0

In my limited experience with Visual WebGui, it is pretty cool technology. In simple terms, as I understand it, you can use the Windows Forms development IDE to create an HTML5-compliant ASP.NET client/server web application... not just a web site or page, with a look and feel very much like a Windows forms desktop application. It does this by converting Winforms controls to jquery code on the client side, and stores most of the executable code on the server side.

I've used it to create simple applications for testing purposes, and there are a few caveats. First, to create a "pretty" website, you need to rethink the Winforms layout to make it web-like, with headers, sidebars, etc. It's a different paradigm, and users expect certain things on a website. The good news is that this adjustment can often be done fairly easy by simply manipulating controls; i.e. a Panel control can become a container for a sidebar or header. You can also create "themes", which are like skins for the controls to modify the appearance.

Another consideration is that events for things like popup dialog boxes behave differently in a web environment. In Winforms program execution halts until the user clicks an "OK" button or something. Within Visual WebGui, all the execution happens on the server side; thus, program execution would continue without waiting for user input. This can be handled by creating a Form.Close handler for the popup box though. But these kinds of differences need to be kept in mind.

You also must consider object layout anomalies. Visual WebGui does a good job generally of mimicking the Winforms WYSIWYG benefit: Objects normally appear pretty close on the webpage to where you put them in the environment. But this isn't always the case; you need to play around with object padding, margins, etc. sometimes to get the right layout. Still it is often much easier than tediously changing spacing with CSS or div objects.

RJ Kelly
  • 179
  • 1
  • 7
MQuiggGeorgia
  • 729
  • 1
  • 7
  • 10
  • 1
    Visual WebGui is no longer in development/support: The only place to find it until Codeplex dies is here: (https://archive.codeplex.com/?p=visualwebgui) – RJ Kelly Mar 23 '18 at 19:11
0

I think this question is very similar to this one:

Is it possible to convert a WinForm to a WebForm in .NET?

As mentioned before, the only way to run the application "as is" inside a browser will be through the use of some activex control and that would require IE + .NET Framework. There are tools that you can use to automatically migrate the application to the Web, but there will always be some manual effort involved and it won't be the same as building the application from scratch as a web app.

Community
  • 1
  • 1
willvv
  • 8,439
  • 16
  • 66
  • 101
0

Thinfinity VirtualUI allows you to do so by adding a small line of code to your C# application so it can then be accessed from any OS and device via an HTML-able browser.

https://www.cybelesoft.com/thinfinity/virtualui/web-integration-for-windows-apps/

Mart Ray
  • 1
  • 1
  • The prices on that are completely unreasonable though. 70 USD per user? Yikes. Use only as a last resort, I would say. – Pangamma Nov 26 '21 at 19:35
0

I've used VWG but it's not really an option anymore. One option not mentioned here is WiseJ, a proprietary framework which is still under active development and support in 2022. And it is fairly straightforward to convert a WinForms app to WiseJ, or begin using WiseJ like you would WinForms.

They are located here: https://wisej.com

A. Niese
  • 399
  • 3
  • 13