PRB: Using the Internet Transfer Control on an ASP Page

ID: Q216288


The information in this article applies to:


SYMPTOMS

When using the Internet Transfer Control on an Active Server Pages (ASP) page that has been deployed on a remote Web server and the remote Web server does not have Visual Basic installed, the following error message occurs when accessing the ASP page:

Server object error 'ASP 0177 : 80040112'

Server.CreateObject Failed

/WebAppRoot/ASPPage.asp, line xx


CAUSE

This problem occurs because the Internet Transfer Control is a licensed control and ASP page does not have the mechanisms to invoke the License Manager for the licensed control.


RESOLUTION

To resolve this problem, encapsulate the ActiveX control in an in-process, ActiveX component (a dynamic-link library, or DLL) that allows the Internet Transfer Control to be redistributed and allows the deployment of the control to the remote Web server.

The following instructions demonstrate how to encapsulate the Internet Transfer Control within a Visual Basic in-process, ActiveX component:

  1. Open Visual Basic and create a New Project.


  2. In the New Project dialog box, select ActiveX DLL and click Open.


  3. In the Project window, right-click Project1 and click Add.


  4. In the Add Form dialog box, select Form and click Open.


  5. Add the Internet Transfer Control to the toolbox. From the Project menu, click Components. In the Components dialog box, select the Microsoft Internet Transfer Control 6.0. Click OK.


  6. Add the Internet Transfer Control to the Form. From the Toolbar, click the Inet control and add the control onto the form.


  7. Now, open Class1 in the Class Module folder under Project1 and add the following code to Class1:
    
    Private objForm As Object
    
    Private Sub Class_Initialize()
        Set objForm = New Form1
    End Sub
    
    Public Function OpenURL(strURL As String)
        OpenURL = objForm.Inet1.OpenURL(strURL)
    End Function
    
    Public Property Let RequestTimeOut(intRTO As Integer)
        objForm.Inet1.RequestTimeOut = intRTO
    End Property
    
    Public Property Get RequestTimeOut() As Integer
        RequestTimeOut = objForm.Inet1.RequestTimeOut
    End Property 
  8. Save the project. From the File menu, click Save Project.


  9. Compile the project into a DLL. From the File menu, select Make Project1.dll.


After you create and compile the ActiveX DLL, you can deploy it and the Internet Transfer Control to the remote Web server. The following steps describe how to deploy the ActiveX DLL and the Internet Transfer Control to a remote Web server.
  1. Copy the Msinet.ocx to the remote Web server. You can copy the ActiveX control to any directory.


  2. Also, copy the ActiveX DLL (Project1.dll) to the remote Web server. Place it in the same location as the Msinet.ocx.


  3. Register the ActiveX control and the ActiveX DLL using RegSvr32.exe. To register the control and the DLL, click the Start button and select Run. In the Run box, enter cmd to bring up the Command window. In the Command window, change to the directory where the control and DLL reside and register the components as shown below:
    
    Regsvr32 MSINET.OCX [Enter]
    Regsvr32 Project1.dll [Enter] 


  4. To test the ActiveX control and ActiveX DLL, use the following server-side Visual Basic Script (VBScript) on an ASP page. You can use Visual InterDev to create the ASP page.
    
    <%@ Language="VBScript" %>
    <% 
    Response.Buffer = true
    set objInetTransCtrl = Server.CreateObject("Project1.Class1")
    
    strPage = objInetTransCtrl.OpenURL("http://msdn.microsoft.com/vinterdev") 'substitute your URL here
    
    Response.Write strPage
    %> 


This sample ASP page instantiates the encapsulated control and renders the home page from Visual InterDev Web site on the browser.


STATUS

This behavior is by design.


MORE INFORMATION

Using the Internet Transfer Control or any other ActiveX controls on an ASP page with server-side script is not supported by Microsoft. ActiveX controls are designed to be run on a client application such as a Web browser (Internet Explorer) or on a Visual Basic form. These controls have events that may require user interaction. Since ASP is processed on the Web server, there is no user interaction to respond to these events when the events are executed by the controls. Hence, other issues may occur when the controls execute their events and require user interaction.

If this should happen with the encapsulated Internet Transfer Control on an ASP page, you may have to create another ActiveX component that uses the WinInet Application Program Interface (API).


REFERENCES

Please refer to the following Web sites for more related information:

http://msdn.microsoft.com/vinterdev/
http://msdn.microsoft.com/vbasic/

Additional query words:


Keywords          : kbActiveX kbASP kbVBp600 kbVisID600 kbGrpASP 
Version           : WINDOWS:5.0,6.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: June 16, 1999