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

G

Guest

Hello

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

Thanks
EJ
 
S

Steven Cheng[MSFT]

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
http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp

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
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx

#Host Secure, Lightweight Client-Side Controls in Microsoft Internet
Explorer
http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx

#Embedded Windows User Controls into Internet Explorer
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187&print
er=t

http://msdn.microsoft.com/msdnmag/issues/02/06/rich/default.aspx

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

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

Thanks
Vani
 
S

Steven Cheng[MSFT]

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 :
(e-mail address removed)

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.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Joined
Aug 18, 2006
Messages
2
Reaction score
0
Exposing win forms as ActiveX using c#

Hi Steven,
Is there a way to expose the windows form(developed in c#) outside of .Net environment? I have seen an article which talks about my requirement but its on beta version(and the article dates back to 2001). The article is at:
http://www.codeproject.com/cs/miscctrl/exposingdotnetcontrols.asp

Is it still possible to create ActiveX control as described in the above article?

Thanks,
Sridhar.

Steven Cheng[MSFT] said:
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
http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp

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
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx

#Host Secure, Lightweight Client-Side Controls in Microsoft Internet
Explorer
http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx

#Embedded Windows User Controls into Internet Explorer
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187&print
er=t

http://msdn.microsoft.com/msdnmag/issues/02/06/rich/default.aspx

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top