Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Host Windows Form user control in asp.net web page as activex control

$
0
0

We are currently using a 3rd party sdk which provides a windows form user control to display some live feeds from camera. The client requirement is to build a asp.net webpage to display this feed. From what i see the only way to do it is to host this windows form control as a com component.

I have tried to create a sample control and then host it in webpage. But i couldnt get it to work. I have tried do the same with wpf control as well.Please help me.

Step-By-Step this is what i have done.

1) I created a class library

2) Added a winform user control to the project.

3) Made the control comvisible by adding the attribute

4) Made the assembly com visible.

5) created a asp.net project

6) copied the winform dll to bin directory if the web project

7) created a webpage and added the winform by using object activation.

Here is my windows form control

namespace CustomUserControlLib
{
    [ComVisible(true)]
    public partial class WindowsFormUserControl : UserControl
    {
        public WindowsFormUserControl()
        {
            InitializeComponent();
        }
    }
}

Here is the body of my webpage.
<body>
    <form id="form1" method="post" runat="server">
        <div>
            <label>Windows Form User Control</label>
            <OBJECT 
                height="100" width="300"
                id="myWindowsFormUserControl" 
                classid="http:CustomUserControlLib.dll#CustomUserControlLib.WindowsFormUserControl" >
            </OBJECT>
        </div>
    </form>
</body>
</html>

Thanks,

Ravi.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>