I want to use .net winform control in asp.net.I wrote the control and displays in asp.net.Is it necessary I have to create a package and deploy in client machine? or since .net framework available in client machine without package it will work.
While this is possible, by hosting a UserControl as Active-X - I generally don't recommend it for a variety of reasons:
- It's basically an Active-X control. There have been a lot of security concerns around this technology.
- It will only work in Internet Explorer. Internet Explorer has been hemorrhaging market share over the past few years.
- Generally it's possible to achieve what you want using JavaScript + HTML. What specific example can you think of where current web standards cannot solve it?
You can learn more about using a WinForm UserControl as an Active-X object here.
In reality, you are better off using browser-based technologies, such as HTML, JavaScript, SVG, etc. If that isn't good enough - then alternative technologies like Silverlight are a much better choice. It's cross-platform, more modern, and designed to run in the browser.
This blog explains how to do it, especially how to package the dll and deploy it (using gacutil).
And, obviously, you will have to have the .net framework on the client computer.
However, in the 2010's I'd would highly suggest you to use more manageable tools, like SilverLigth, Flash, or event Html + Javascript (jQuery is your friend)
You can not do what you are wanting to do. WinForms controls have no way to render as HTML.
You can't use a WinForms control in ASP.Net.
ASP.Net controls render to html on a webpage. WinForms controls run in a message loop on the client machine.
精彩评论