Search code examples
c#asp.netwinformsasp.net-corewinforms-to-web

Running an exe application from local resource inside ASP .Net Core HTML page


My software is splitted into 2 parts:

  1. ASP .Net Core 3.1 application which is hosted on server
  2. .NET Framework 4.8 WinForms applicaнion which is deployed on client PC (I can try to place it on server if this greatly simplifies the solution of the problem). The reason why I need this separate application is third-party control that is available only for .NET Framework desktop - WinForms and WPF (unfortunatelly I cannot avoid using or replace it).

Is it possible to run that client PC application inside ASP Net Core HTML page? I don't need just launch it with System.Diagnostics.Process or similar techniques, I want I want to embed it in a ASP frame somehow. Something like WindowsFormsHost for WFP or ElementHost for WinForms.

Any help is appreciated. Thank you in advance.


Solution

  • Basically, you have these options:

    • Wrap your desktop app into ActiveX, use IE Tab extension (or similar one), and run ActiveX on the page. The worst one because of, well, ActiveX. In fact, you will not be able to use modern browser features.
    • Throw away Web UI. If you need desktop app (it doesn't matter why), then use desktop app and Web API at server side. The easiest and obvious one. You're still linked to desktop, so what is the reason to ignore this fact?
    • Render mentioned control's output at server side, and send the result to browser. This depends on what the control is, what it does, how much interactivity it requires, etc. Also, this assumes, that you must be able to run .NET 4.8 process on your server and communicate with it from .NET Core app.