开发者

Access ActiveX Controls using C# ASP.NET

Can someone tell me how to retrieve an ActiveX component with an OBJECT tag?

On my ASP file I have retrieved an ActiveX control with the following code:

<OBJECT classid="clsid:A919AF5F-637C-423E-835A-B56448C1AD9B">
</OBJECT>

The result is that the Activex control popup on the web page..so far so good.

The problem is that this piece of code always look for the ActiveX control on the Client machine, I want the ActiveX control to be retrieved from the server (of course)

In the documentation for the OBJECT tag, I saw that there was an attribute called RUNAT=Server that should be included to get the object from the Server instead, so I tried with the following code to retrieve the ActiveX from the server instead of the clients machine

 <OBJECT RUNAT=Server id=whatevername
    classid="clsid:A919AF5F-637C-423E-835A-B56448C1AD9B">
    </OBJECT>

...but, when I do like this, the ActiveX control doesn't show up. Can someone understand why ?? Is it neccesary 开发者_Go百科to instantiate the "whatever"-id before I use it in the OBJECT-tag, or can this id be set to whatever value ? ....I only want the ActiveX to show up in the clients browser, WHAT is wrong ??


ActiveX is a client-side technology only. It is designed to allow COM objects registered on the client machine to be instantiated in the browser.

Therefore, the question you should be asking is "How do I install/register my COM object on the client PC".

Bascially, you will need to add a codebase attribute to your object tag, specifying a URL to your (correctly packaged) ActiveX object. e.g.:

<object 
    classid="clsid:<guid>" 
    codebase="http://mydomain.com/path/to/mycabfile.cab">
</object>

The ActiveX object will typically be packaged in a CAB file and, if it was written in .NET, then it will need to be packaged in an MSI inside the CAB file.

For information on deploying a .NET ActiveX component from a web-server, please see my answer here.

For information on deploying a non .NET component, just search Google - it's much more straightforward than the .NET way!

Finally, if you are in an intranet environment, don't forget to consider using Active Directory Group Policy, or a similar technology (like SMS), for deploying the ActiveX component - it might be a lot simpler this way.


ActiveX showed up initially as client side component standard in 1995 but 4 years later became standard for server side wbe apps. All classic ASP web application systems/PHP/ColdFusion/Perl on Windows were built with non interactive ActiveX sever side components allowing increase of performance for interpreted VBScript-based web application code and access to all kind of APIs and distributed COM functionality on server side.

COM+ added possibility to run these components in efficient way e.g allowing pooling of COM+ applications/COM objects/threads.

ActiveX is a simplified version of OLE with only a two mandatory light weight interfaces to be implemented by COM component to be ActiveX (vs numerous interfaces required by OLE): IUnknown (lists available properties/methods exposed by ActiveX component) and IDispatch for late binding of methods and functions.

ActiveX server side support allowed simplistic generic type-based web app programming style without need to care about type declaration. It supported popularity growth of XP programming style and Agile SDLC in general.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜