<%
Dim Request As ASPTypeLibrary.Request
Dim Response As ASPTypeLibrary.Response
Dim Server As ASPTypeLibrary.Server
Dim Session As ASPTypeLibrary.Session
Dim Application As ASPTypeLibrary.Application
' this method is called when the object is instantiated
' in the context of the ASP script
Public Sub OnPageStart(AspSC As ASPTypeLibrary.ScriptingContext)
' save variables pointing to main ASP objects
Set Request = AspSC.Request
Set Response = AspSC.Response
Set Server = AspSC.Server
Set Session = AspSC.Session
Set Application = AspSC.Application
End Sub
' this method is called when IIS is about to destroy the object,
' after completing the processing of the ASP page.
Public Sub OnPageEnd()
' add here the code to be processed *after* the script
' in the ASP has completed its execution
End Sub
However, under IIS 5 (and IIS 4 under MTS) you should build your ASP components without using the OnStartPage method. Instead, you should retrieve the reference to the five main ASP objects using the ObjectContext object and the GetObjectContext method, as follows.
Dim Request As ASPTypeLibrary.Request
Dim Response As ASPTypeLibrary.Response
Dim Server As ASPTypeLibrary.Server
Dim Session As ASPTypeLibrary.Session
Dim Application As ASPTypeLibrary.Application
Private Sub Class_Initialize()
Dim objCtx As ObjectContext
Set objCtx = GetObjectContext
Set Request = objCtx.Item("Request")
Set Response = objCtx.Item("Response")
Set Server = objCtx.Item("Server")
Set Session = objCtx.Item("Session")
Set Application = objCtx.Item("Application")
End Sub
%>