Share via


PassportIdentity.AuthUrl2(string)

PassportIdentity.AuthUrl2(string)

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)

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.

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) 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)) {


 //Display the AuthUrl2 return value.
 Response.Write ("<br>AuthUrl = " + oMgr.AuthUrl2(sthisURL));
}
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%3D1026334182%26cb%3D
co-brand-args%26ems%3D1%26ver%3D2.1.0191.1%26tpf%3Dc3407e47996eda9cb953af2cd4ca4072

Remarks

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