Microsoft KB Archive/299635

From BetaArchive Wiki
Knowledge Base


Article ID: 299635

Article Last Modified on 6/29/2004



APPLIES TO

  • Microsoft Active Server Pages 4.0



This article was previously published under Q299635


SUMMARY

This step-by-step procedure demonstrates how to write a Component Object Model (COM) component for use within Active Server Pages (ASP).

back to the top

The COM Component for ASP

  1. Create a new ActiveX DLL project in Visual Basic.
  2. Name the project VBASPProject, and name the class VBASPClass.
  3. Paste the following public method into the class module:

    Public Function GetString() As String
        ' Return the string Hello World!
        GetString = "Hello World!" 
    End Function
                        
  4. From the File menu, click Make VBASPProject.dll to compile the dynamic-link library (DLL).
  5. In Notepad, create a new ASP file, and paste the following code:

    <%
           set obj = Server.CreateObject("VBASPProject.VBASPClass")
           Response.Write obj.GetString
    %>
                        
  6. Save this ASP file in a virtual directory that is a Microsoft Internet Information Server (IIS) Web Application.
  7. In your Web browser, run the ASP page. The text, "Hello World!", is displayed.

back to the top

REFERENCES

The preceding sample is very simplistic. For more information on building scaleable Visual Basic components for use in ASP pages, refer to the following articles:

243548 INFO: Design Guidelines for VB Components Under ASP


264957 BUG: VB DLL Has Memory Leaks and Crashes in COM+ if 'Retain In Memory' Not Set


back to the top

Keywords: kbhowto kbhowtomaster KB299635