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
- 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 = "Hello World!" 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("VBASPProject.VBASPClass") Response.Write obj.GetString %>
- Save this ASP file in a virtual directory that is a Microsoft Internet Information Server (IIS) Web Application.
- In your Web browser, run the ASP page. The text, "Hello World!", is displayed.
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
ASP Component Guidelines
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnserv/html/server01242000.asp
Agility in Server Components
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dniis/html/agility.asp
Keywords: kbhowto kbhowtomaster KB299635