次の方法で共有


Manager.LoginUser

Manager.LoginUser

The LoginUser method logs the user on, either by initiating an HTTP 302 redirect URL, or initiating a Microsoft .NET Passport-aware client authentication exchange.

Syntax

Sub Manager.LoginUser ([returnUrl], [TimeWindow], [ForceLogin], 
            [coBrandArgs], [lang_id], [NameSpace], [KPP], [SecureLevel], [ExtraParams])

Parameters

  • returnUrl
    Optional string representing the return URL to which to send the user upon successful sign-in. Supply a NULL value to indicate that .NET Passport should use the return URL value specified in the Passport Manager Administration utility. The return URL must be fully qualified and point to a named file, not just a directory or the server root.
  • TimeWindow
    Optional integer indicating the interval, in seconds, during which .NET Passport users must have last signed in to the calling domain. The value entered for TimeWindow must be -1, or greater than or equal to 20, and less than 2678400 (between 20 seconds and 31 days). The TimeWindow parameter is used in conjunction with the ForceLogin parameter. Pass -1 to indicate that .NET Passport should use the default value specified in the Passport Manager Administration utility.
  • ForceLogin
    Optional Boolean value that determines how the TimeWindow parameter is used. If set to True, the Login server will compare the TimeWindow interval with the time the user last manually signed in. If set to False, then TimeWindow is compared with the last time the Ticket was refreshed either silently or manually.
  • coBrandArgs
    Optional string specifying variables added to the query string for the URL of the participating site's cobranding template script page. Pass a NULL value to indicate that .NET Passport should use the default specified in the Passport Manager Administration utility.
  • lang_id
    Optional integer specifying the user's preferred Sign-in page language. Supply a NULL value to use the default specified in the Passport Manager Administration utility.
  • NameSpace
    Optional string indicating a namespace to which a user without a .NET Passport is sent by the Login server. The specified namespace must appear as a "domain name" entry in the Partner.xml Component Configuration Document (CCD).
  • KPP
    Optional integer indicating data collection policies for the purpose of compliance with the parental consent requirements of children's privacy laws, such as the Children's Online Privacy Protection Act (COPPA). Supply a -1 to indicate that .NET Passport should use the default value.
  • SecureLevel
    Optional integer that determines the security level of the sign-in. For information about the available values for SecureLevel, see Manager.IsAuthenticated.
  • ExtraParams
    Optional string of name-value pairs for insertion directly into the challenge authentication header specifically for .NET Passport-aware authentication interaction. Supply a NULL value to indicate that .NET Passport should use the default value. The primary purpose of the ExtraParams parameter is to pass in a value for the cbtxt variable. cbtxt is used to specify customizable text in the Credentials Manager dialog box of .NET Passport-aware applications, and is typically used to identify this authentication as being specifically a .NET Passport authentication. The value following cbtxt= should be a quoted string.

Return values

This method does not have a return value. The effective "return" of the method is to write a 302 redirect directly into the HTTP header of the response, and thus replace the response that would ordinarily be produced by a page.

Example

The following Microsoft Visual Basic Scripting Edition (VBScript) code snippet performs a sign-in.

<%@ Language=VBScript %>
<HTML>
<HEAD><TITLE>Login User</TITLE></HEAD>
<%
'Create a Passport Object
Set oMgr = Server.CreateObject("Passport.Manager")
thisURL = "https://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")
ruURL = thisURL & "/../default.asp"
TimeWindow = oMgr.GetCurrentConfig("TimeWindow") 'optionally use null
ForceLogin = True 'optionally use null
coBrandArgs = oMgr.GetCurrentConfig("CoBrandTemplate") 'optionally use null
lang_id = oMgr.GetCurrentConfig("LanguageID")'optionally use null
NameSpace = oMgr.DomainFromMemberName(oMgr.Profile("MemberName")) 'optionally use null
KPP = 1 'optionally use -1
SecureLevel = 0
ExtraParams = null 
'Use any one of the following statements to perform the login

'Using all of the defined parameters
oMgr.LoginUser ruURL,TimeWindow,ForceLogin,coBrandArgs,lang_id,NameSpace,KPP,SecureLevel,ExtraParams 

'Omit the defined TimeWindow; use the default TimeWindow
'oMgr.LoginUser ruURL,,ForceLogin,coBrandArgs,lang_id,NameSpace,KPP,SecureLevel,ExtraParams 

'Omit the defined returnUrl; use the default returnUrl
'oMgr.LoginUser ,TimeWindow,ForceLogin,coBrandArgs,lang_id,NameSpace,KPP,SecureLevel,ExtraParams 

'Omit the defined returnUrl and TimeWindow; use the default returnUrl and TimeWindow
'oMgr.LoginUser ,,ForceLogin,coBrandArgs,lang_id,NameSpace,KPP,SecureLevel,ExtraParams 
%>
</Script>
</HTML>

Remarks

The LoginUser method allows the user to perform a silent or manual sign-in, depending on the TimeWindow and ForceLogin parameters. Upon sign-in, the user is redirected to the returnUrl specified.

In the preceding example, changing the value of ForceLogin from True to False would allow a silent sign-in to occur. The silent sign-in would occur when the LoginUser method was called and the TicketAge is greater than the TimeWindow parameter. When this method performs the sign-in, the Ticket is refreshed (that is, the TicketAge is reset to 0).

See Also

Passport Manager Object