How do I make an activeX control in a C# library project and then reference it in another ASP.NET wet site project?
views:
1802answers:
3Hi Igor,
If you're using C#/.NET to build your control and consuming it from ASP.NET you would get better performance (and cause yourself much less pain) by referencing it as a standard .NET assembly, bypassing ActiveX altogether. Hope this helps!
Adam
Is the ActiveX for the client, or for the server?
If for the server, just use a direct reference to the managed assembly (no need for COM).
Re the client, frankly I'm not sure it is a good idea to be writing ActiveX controls - most browsers won't love them. You'd do better with AJAX and DHTML, or Silverlight / Acrobat / etc for something more complex.
[update] So you want ActiveX at the client... my next though would be "can Silverlight access the certificate store?" I can't find anything, though...
Distributing an ActiveX control (for IE) is usually a matter of packaging the dll into a cab, marking it as safe for scripting and safe for activation. You then place the cab on the web-server, and on the bage you have an <object...>...</object>
element specifying the source (code-base) of the cab.
I have to stress that this approach is going to be very hit-and-miss; it won't work on many browsers, and will work soem of the time on IE (depending on the user's security settings). I don't recommend it.
A more practical option might be to write a standalone .NET exe that you package via ClickOnce ("Publish" in VS); drop the ClickOnce deployment on the web-site, and navigate to the application. Voila - full .NET code at the client, without the browser issues.