By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

How to create Activex Control using C# and Use it in ASP.NET webform?

P: n/a

I would like to create Activex Control uisng C# and use it in ASP.Net webform. User Control is not solving my requirement so I am going for Activex Control.

Please guide me on this, how to do it, if any sample is provided will be of great help

Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Hi E J,

From your description, you're wanting to create an ActiveX control via C#
and use it in ASP.NET web page, yes?

As for the question, here are some of my suggestions:
1. Since C# is a dotnet based language, it only support building managed
component or control(.net code). And there is not buildin means for
developing COM or ActiveX COMPONENT directly in .net(C# or VB.NET). I think
we still need to use C++ or VB(I recommend this since it'll save us a lot
of time) to develop COM or ACTIVEX compoents or controls.

2. There is one feature called Interop in .net which help to expose
COM/ActiveX components to dotnet or expose .net components/control to COM
interfaces. So there is means that we develop an .net winform control and
expose it as an ACTIVEX control and use it. The following tech article has
dicussed on this:

#Simple way to expose a .NET WinForm control as an ActiveX control in any
HTML page

3. As #2 has mentioned that we can expose a .net Winform control as activeX
and use in web page. However, the .net has provide another nice feature
----------IE host Winform controls--------- which can directly help use
Winform control in IE. I recommend that you have a look at this means. And
here are some certain

#Using Windows Forms Controls in Internet Explorer

#Host Secure, Lightweight Client-Side Controls in Microsoft Internet

#Embedded Windows User Controls into Internet Explorer

Hope helps. Thanks.


Steven Cheng
Microsoft Online Support

Get Secure!
(This posting is provided "AS IS", with no warranties, and confers no

Get Preview at ASP.NET whidbey

Nov 18 '05 #2

P: n/a
HI Steven

Thanks for the valuable suggestions

I tried using Winform User Control in ASP.Net webform, but I am having trouble using it. When a winform User Control contains WebBrowser control in it, the user control is not getting displayed. Just blank text box kind of control is getting displayed depending upon the specified size and width.

The properties in IIS for the hosted control site is set to Execute Sctipt . Any other settings is required for this to be run

Nov 18 '05 #3

P: n/a
Hi Ej,

I found that the problem in this issue is just caused from the one
mentioned in another thread in this newsgroup
The title is
Subject: Firing Click events and Reading IFrame Source of External URL in
ASP.NET web form

Is it right? I think your problem is not with the winform control but with
your security setting on the client machine. You need to adjust the Code
Access Seurity on the client machine so as to allow the winform control
execute in the client machine's IE host CLR enviroment. I've posted my
reply in that thread and also have send a mail and attached my demo project
and some related screen shots. I send it via the following address :

If it is not correct, please feel free to let me know and I'll resend.
Also, if you feel it convenient that we continue to discuss in that thread,
please feel free to post here. Thanks.


Steven Cheng
Microsoft Online Support

Get Secure!
(This posting is provided "AS IS", with no warranties, and confers no

Get Preview at ASP.NET whidbey

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.