Поделиться через


Manager.OnStartPageASP

Manager.OnStartPageASP

The OnStartPageASP method initializes the Passport Manager object using Active Server Pages (ASP) Request and Response objects.

Syntax

Sub tManager.OnStartPageASP (pdispRequest,pdispResponse)
  • pdispRequest
    The Request object for the current connection.
  • pdispResponse
    The Response object for the current connection.

Return values

This method does not have a return value.

Example

The following Microsoft Visual Basic Scripting Edition (VBScript) code snippet demonstrates the use of the OnStartPageASP method.

Create a Passport Factory object in application scope. Add the following code to the global.asa file for your project.

<Object runat=server scope=application progid="Passport.Factory" id="oFactory" ></Object>

You can then access the object by its ID to create a Passport Manager.

<%@ Language=VBScript %>
<HTML>
<HEAD><TITLE>OnStartPageASP Exercise</TITLE></HEAD>
<%
'Create a Passport Manager object
Dim oMgr
Set oMgr = oFactory.CreatePassportManager
oMgr.OnStartPageASP Request, Response
thisURL = "https://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")
If oMgr.IsAuthenticated Then
 'Set the sign-out URL - return to the Default.asp
 ruURL = thisURL & "/../../Brief/default.asp"
Else
 'Set the sign-in URL - stay on this page
 ruURL = thisURL
End If
TimeWindow = 3600
Response.Write("<DIV STYLE = 'position:absolute; right:50px'>" & oMgr.LogoTag2(ruURL,TimeWindow,FALSE,"nothing","1033",False,"nothing",0,0) & "</DIV>")
If oMgr.IsAuthenticated(TimeWindow,True,False) Then
 'Do something here for an authenticated user.
 Response.Write ("<br>You are authenticated.")
Else
 'Your authentication has expired. Sign in again.
 oMgr.LoginUser thisURL,TimeWindow,True
End If
%>
</HTML>

Remarks

This method instantiates the Passport Manager object using the supplied interface pointers instead of handling query strings and cookies through the built-in OnStartPage method. This method is used primarily to instantiate ASP Passport Manager objects created in application scope with the Passport Factory object.

PassportManager.OnStartPageASP must be called on any Passport Manager object created with Passport Factory in ASP before any other Passport Manager object methods will give correct results. OnStartPageASP does not have to be called on any Passport Manager object created by the usual means, in page scope using Server.CreateObject. Page scope Passport Manager objects perform the OnStartPage when the page is loaded.

See Also

Passport Manager Object | Passport Manager Built-In Methods | Passport Factory Object