Share via


PassportIdentity.AuthUrl2(string,int,int,string,int,string,int,int)

PassportIdentity.AuthUrl2(string,int,int,string,int,string,int,int)

Returns a string containing the Login server URL for a user's domain, as well as optional information sent to the Login server in the query string.

Important  This method takes advantage of the Microsoft® .NET Passport authentication capabilities that are built into Microsoft® Windows® XP. If you use this method to generate a link to the Login server, users who are using Microsoft® Internet Explorer 6 on Windows XP will enter their credentials into the .NET Passport sign-in user interface (UI) that is integrated into the operating system. As a result, any customized cobranding you supply will not be displayed. If you want to ensure that all users sign in using the cobranding-enabled Web UI, use the AuthURL method. For more information, see PassportIdentity.AuthURL.

Syntax

public string AuthUrl2(
    string strReturnUrl,
    int iTimeWindow,
    int iForceLogin,
    string strCoBrandedArgs
    int iLangID,
    string strNameSpace,
    int iKPP,
    int iSecureLevel
    )

Parameters

  • strReturnUrl
    The return URL to which to return the user upon a successful sign-in. Sets the URL of the location to which the Login server should redirect users after they sign in or out. Pass a null reference to indicate that .NET Passport should use the default value specified in the application. The return URL must be fully qualified and point to a named file, not just a root.
  • iTimeWindow
    Specifies the interval during which users must have last signed in to the calling domain. Pass -1 to indicate that .NET Passport should use the default value. The value entered for iTimeWindow must be -1, greater than or equal to 20, and less than 2678400 (between 20 seconds and 31 days).
  • iForceLogin
    Determines how the iTimeWindow parameter is used. If set to a value other than 0, the Login server will compare iTimeWindow interval against the time since the user last manually signed in. If set to 0, then the Login server will compare iTimeWindow against the last time the Ticket was refreshed, either silently or manually.
  • strCoBrandedArgs
    Specifies variables to be appended as query string variables to the URL of the participating site's cobranding template script page. Pass a null reference to indicate that .NET Passport should use the default value.
  • iLangID
    Specifies the language to be used for the Sign-in page that is displayed to the user. Pass -1 to indicate that .NET Passport should use the default value specified in the Passport Manager Administration utility.
  • strNameSpace
    A namespace to which a user without a .NET Passport is directed to by the Login server where the Get a New Passport link is displayed on the initial Sign-in page.
  • iKPP
    Specifies data collection policies for the purpose of complying with the parental consent requirements of children's privacy laws, such as the Children's Online Privacy Protection Act (COPPA). Pass -1 to indicate that .NET Passport should use the default value.
  • iSecureLevel
    An integer that declares the secure level with which the Sign-in page will be served. The value may be 0, 10, 100, or -1, which indicates that the default secure level value for the site should be used. For more information about the accepted values for iSecureLevel, see PassportIdentity.GetIsAuthenticated(int,int,int).

Return values

Returns a URL used for sign-in on the user's domain and optional parameters.

Example

The following C# example displays the value of the overloaded AuthUrl2(sruURL,iTimeWindow,iForceLogin,strCoBrandedArgs,iLangID,StrNameSpace,iKPP,iUseSecureAuth) method. The parameters in this method override the default parameters specified in the Passport Manager Administration utility.

<%@ Page Language="C#"%>
<%@ Import Namespace = "System.Web.Security" %>
<HTML>
<HEAD><TITLE>Mysample - Exercise - CS</TITLE></HEAD>
<Script language="C#" runat="server">
 string sServer;
 string sthisURL;

 protected void Page_Load(Object src, EventArgs e) {
 sServer = Request.ServerVariables["SERVER_NAME"];
 sthisURL = "https://" + sServer + Request.ServerVariables["SCRIPT_NAME"];
}
</Script>
<%
//Instantiate a PassportIdentity object.
PassportIdentity oMgr = (PassportIdentity)Context.User.Identity;

//LogoTag2 allows the user to sign in or out.
Response.Write ("<DIV STYLE = 'position:absolute; right:50px'>" + oMgr.LogoTag2(sthisURL,3600,true,null,1033,false,null,-1,false) + "</DIV>");

if (oMgr.GetIsAuthenticated(3600,false,false)) {
 //Define additional parameters
 int iTimeWindow = 3600;
 int iForceLogin = 1;
 string strCoBrandedArgs = null;
 int iLangID = 1033;
 string strNameSpace = null;
 int iKPP = -1;
 int iUseSecureAuth = 0;

 //Display the AuthUrl2 return value.
 Response.Write ("<br>AuthUrl = " + oMgr.AuthUrl2(sthisURL, iTimeWindow, iForceLogin, strCoBrandedArgs, iLangID, strNameSpace, iKPP, iUseSecureAuth));
}
else {
 Response.Write("<br>You are not authenticated. Please click Sign In or exit the page.");
}
%> 

The preceding example may display output similar to the following: 

AuthUrl = https://localhost/BriefCS/Exercise.aspx?msppchlg=1&mspplogin=
https://current-login.passport-ppe.com/login.srf%3Flc%3D1033%26id%3D23248%26ru%3D
https://localhost/BriefCS/Exercise.aspx%26tw%3D3600%26fs%3D1%26kv%3D1%26ct%3D1026333771%26cb%3D
co-brand-args%26ems%3D1%26ver%3D2.1.0191.1%26tpf%3D3f320cd2220dd41e0f5f10bd2dfd7c69

Remarks

This overloaded method returns the return URL, the .NET Passport server URL, the Site ID, the time window, and the cobranding arguments for the user. 

This method returns a string that contains the URL of the calling page, plus a query string variable that contains the URL of .NET Passport Login server with parameters used by the Login server given in an encoded query string. Do not attempt to append query string information or other characters to the URL returned by this overloaded AuthURL2 method.

This method does not redirect the user to the return URL. This URL can be used to generate a link for a user who has not signed in previously or who has an expired Ticket.

The returned values contain the values in this method, overriding the registry default values specified in the Passport Manager Administration utility.

See Also

Passport PassportIdentity Object | PassportIdentity.AuthUrl2