Take the 2-minute tour ×

I want to embed an ActiveX wrapper (System.Windows.Forms.AxHost) that is created by the server and sent to the client to be displayed in a webpage and kept updated Is that possible ? I think it can be done using an object, but not sure how to exactly do it using C# ASP .Net

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Reading into your question you may be more specifically asking this:

  • I want an instance of an activex control that is instantiated on the server rendered on the client, and kept up to date, interactive etc etc as if it had been instantiated on the client.

No this is not possible. When you pass <object classid="sid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"/> from the server you are not passing an instance of that object. You are sending a directive to the client to instantiate and render that object. At the end of the day http communication is just text, not blocks of memory and executable code (which is what an instantiated object is). Anything spit out by the server has to be instantiated on the client. Browsers do so for html tags and might do so objects if they

  1. support the object (java objects require a JVM, activex objects require MS infrastructure)
  2. the object is installed or installable (the code the has to execute on the client so the code has to get there)
  3. local security settings allow this sort of thing (which is often and more and more commonly not the case)

ActiveX controls are by their very nature client side (and best avoided for more secure and widely supported technologies for creating robust web UI's like ajax)

share|improve this answer
How else would you suggest I do this ? I want to send a server side initiated component and show maybe an image of it or mirror it somehow to the client with interaction and send this interaction back to the server to apply it on the server object, maybe JavaScript and ajax ? or is there an other simpler way or technology to do this ? –  Ihab Hajj Jan 6 '13 at 12:31
@IhabHajj - boy I cannot think of a good solution. ActiveX controls just are not meant to work look that. I cold see sending an image of a server instantiated control but keeping it "interactive" would be difficult at best. Do you control the source of this activex control? I would explore other approaches. –  dkackman Jan 6 '13 at 22:47
Yes I have complete control of both the ActiveX , server side code and client side actions, so security issues or compatibility with IE or whatever aren't a problem for me –  Ihab Hajj Jan 7 '13 at 18:48
In that case try to deploy the activex to the clients and proceed as normal. If you can't do that all I can see is a need to re-implement the activex control as some sort of asp.net control. –  dkackman Jan 7 '13 at 18:53
My activex control is already a .Net control, maybe i should try to convert my server side activex into a javascript built html image (which would be dynamic in this case) and handle user input on the client side and send it back to the server to be submitted on the server activex control, that was my initial concept but it seemed to complicated as I was looking for a simpler solution. –  Ihab Hajj Jan 8 '13 at 12:19

I do believe this article may be helpful to you, 'Hosting a Windows Control in a Web form'.


I'd like to quote the remarks, though, and keep this points in mind: 'Hosting a Windows Control in ASP.NET has several limitations worth discussing. First it requires both that the client machines have, at minimum, the .NET redistributable installed and be browsing with Internet Explorer 5.01 or later. [...] Second, ASP.NET cannot host Windows Forms. You'll need to abstract those parts to Windows Controls. Lastly, because the Windows Control is not a Web control that can be run at the server, the properties can not be easily set or read during a postback.'

share|improve this answer

Your Answer


