VB中使用ASP对象实例

开发步骤:
1.新建立Activex Dll 项目
2.修改Project 名称
3.修改Module名称
4.添加引用:在NT和98下开发时,必须在项目中引用Microsoft Transaction Server Type Library,在Windows 2000下开发,必须引用COM+ Service Type Library。
5.调试代码,生成*.dll文件

Option Explicit

    Dim m_objResponse As Response

    Dim m_objRequest As Request

    Dim m_objServer As Server

    Dim m_objApplication As Application

    Dim m_objSession As Session

    Private Sub Class_Initialize()

    Dim objContext As ObjectContext

    Set objContext = GetObjectContext()

    Set m_objResponse = objContext("Response")

    Set m_objRequest = objContext("Request")

    Set m_objServer = objContext("Server")

    Set m_objApplication = objContext("Application")

    Set m_objSession = objContext("Session")

    End Sub

    Public Sub ASPTest()

    m_objResponse.Write "告别写字板,使用VB环境编写ASP程序!"

    End Sub

6.在IIS中测试ASP代码

<%Set objTest = Server.CreateObject("ASPObject.ASPCLass")
objTest.ASPTest
Set objTest = Nothing
%>

你可能感兴趣的:(VB中使用ASP对象实例)