This
		  step-by-step article describes how to access ASP.NET intrinsic objects in a
		  Microsoft Visual Basic Component Object Model (COM) component.
Requirements
- Microsoft Windows 2000 Professional, Windows 2000 Server,
				Windows 2000 Advanced Server, or Windows XP Professional
- Microsoft Internet Information Services (IIS)
- Microsoft .NET Framework
Create a Visual Basic Component
 To create a Visual Basic 6.0 COM component: 
		  
- In Visual Basic 6.0, create a new ActiveX DLL
				project.
- On the Project menu, click
				References.
- In the References dialog box, click to
				select theCOM+ Services Type Library (Comsvcs.dll) and
				Microsoft Active Server Pages Object Library (Asp.dll) check
				boxes, and then click OK.
- Change the project name to
				ObjectCtxtProject, and then change the class name to
				ObjectCtxtClass. 
- On the Project menu, click
				ObjectCtxtProject Properties. 
- Click to select the Unattended Execution
				and Retained In Memory check boxes, and then click
				OK.
- Add the following code to the ObjectCtxtClass class:Public Sub TestMethodObjectCtxt()
        Dim objContext As ObjectContext
        Dim objResponse As Response
        Dim objRequest  As Request
        Dim objApplication  As Application
        Dim objSession As Session
        Set objContext = GetObjectContext()
            
        Set objApplication = objContext("Application") 	' Obtain ASP Application object.
        Set objSession = objContext("Session") 		' Obtain ASP Session object.
        Set objResponse = objContext("Response") 	' Obtain ASP Response object.
        Set objRequest = objContext("Request")   	' Obtain ASP Request  object.
        'This code uses the Response object (objResponse).
        'You can use other intrinsic objects in a similar fashion.
        objResponse.Write "Hello World!"
      
End Sub
- On File menu, click Make
				ObjectCtxtProject.dll to create the DLL.
Add the Visual Basic Component to Component Services
To add the Visual Basic component to Component Services: 
		  
-  On the Start menu, point to
				Settings, and then click Control
				Panel.
- Double-click Administrative Tools, and
				then double-click Computer Management. 
- Expand Component Services , expand
				Computer, expand My Computer, and then expand
				COM+ Applications.
- Right-click COM+ Applications, point to
				New, and then click Application.
- In the COM+ Application Install Wizard, click
				Next. 
- On the Install or Create a New Application
				page, click Create an empty application.
-  In the text box, type AspCtxTest.
				Click Next two times, and then click Finish.
				
- In the console tree, under COM+
				Applications, expand AspCtxTest node, and then click
				Components. 
- Drag the ObjectCtxtProject.dll file from Windows Explorer
				to the right pane of the Microsoft Management Console (MMC). This registers the
				ObjectCtxtProject.dll file in Component Services.
Test the Component on an ASP.NET Page
 To test the component: 
		  
- In Notepad or another text editor, paste the following
				code:<%@ Page aspcompat=true %>
<%
       Dim obj As Object 
       obj = Server.CreateObject("ObjectCtxtProject.ObjectCtxtClass")
       obj.TestMethodObjectCtxt
       obj = Nothing
%> 
						
- Save the text file with the .aspx file name extension in
				the virtual folder of a Microsoft Internet Information Services (IIS) Web
				application. 
- Open Microsoft Internet Explorer, and then open the .aspx
				page. You see text that reads "Hello World!"