Internet Explorer (IE) supports the OBJECT tag for hosting classic ActiveX controls. In .NET, the OBJECT tag can be used to also host Windows Forms controls and provide accesses to the properties of the hosted control. For those of you familiar with hosting ActiveX controls, the syntax for the OBJECT tag will seem very familiar. The only difference is the CLASSID attribute used to identify the control to be created. The general form of the OBJECT tag is as follows:
<OBJECT ID="<var-name>" CLASSID="http:<assembly>#<qualified-name>" height="<height>" width="<width>"> <PARAM NAME="<property-name>" VALUE="<property-value>"> </OBJECT>
IE places the following constraints when hosting .NET controls within the browser:
It requires Full-Trust for COM Interop (Event Handling).
The assembly must be in the current virtual directory or in the Global Assembly Cache.
Permissions for the virtual directory must be set to “Scripts only.” Setting permissions to “Scripts & Executables” will not allow the control to be hosted.
As long as these conditions are met, hosting a control is a fairly simple process. Listing 10.5 shows a basic aspx page for hosting the IconButton developed earlier.
The output produced from Listing 10.5 is shown in Figure 10.4.
18.119.131.178