简体   繁体   中英

Embedding Windows Form in an ASP.net webpage

I have written a Chat application using C#. The project is a separate Windows forms application. Now i do not want to write the entire code in the project where i am creating a webpage using asp.net. I want to do something like this:

  1. The user opens the webpage,
  2. Registers,
  3. On the next page there would a button [Toolbox button] which the users clicks and that would initialize my form and hence the chat application.

How can i achieve this?

That is completely impossible (except for IE-only).

WinForms and web development are completely different.

You could deploy your WinForm application as a Click-Once .Net deployment, and link the users to this after registering. However, you'd need to ensure your app works in this type of environment, and you'd begin limiting your user base because it would require they have the same version of the .Net framework and the ability to run a click-once application.

What you are asking is to have the browser download your application and run it locally on the machine. You have to make sure that the user's machine is compatible ie that it is running Windows with the correct version of the .Net runtime (for non-Windows machine, it has to have the correct version of Mono and the application should be compatible with it).

Most browsers will prevent you from directly downloading an application and running it. You will have to give users explicit instructions on how to save and run the app. For Windows machines, you can use ClickOnce to automatically install and run the application.

Another option worth considering is converting your app to Silverlight. It provides a lot of the interactivity of a desktop application while being hosted on a web page and while using C#.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM