Microsoft KB Archive/299635

= How To Write a Visual Basic COM Component for Use Within Active Server Pages =

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





IN THIS TASK
SUMMARY
 * The COM Component for ASP

REFERENCES



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
 Create a new ActiveX DLL project in Visual Basic. Name the project VBASPProject, and name the class VBASPClass.  Paste the following public method into the class module: Public Function GetString As String ' Return the string Hello World! GetString = &quot;Hello World!&quot; End Function  From the File menu, click Make VBASPProject.dll to compile the dynamic-link library (DLL).  In Notepad, create a new ASP file, and paste the following code: <%      set obj = Server.CreateObject(&quot;VBASPProject.VBASPClass&quot;) Response.Write obj.GetString %>                    Save this ASP file in a virtual directory that is a Microsoft Internet Information Server (IIS) Web Application.</li> In your Web browser, run the ASP page. The text, &quot;Hello World!&quot;, is displayed.</li></ol>

back to the top