Share via


PassportIdentity.AuthUrl2()

PassportIdentity.AuthUrl2()

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

Return values

Returns a URL for a user's domain and optional parameters.

Example

The following C# example displays the value of the AuthUrl2() method. The default parameters specified in the Passport Manager Administration utility are used.

<%@ 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());
}
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/Default.aspx?msppchlg=1&mspplogin=
https://current-login.passport-ppe.com/login.srf%3Flc%3D1033%26id%3D23248%26ru%3D
https://localhost/BriefCS/Default.aspx%26tw%3D14400%26fs%3D1%26kv%3D1%26ct%3D1026334530%26cb%3D
co-brand-args%26ems%3D1%26ver%3D2.1.0191.1%26tpf%3D12d77d58b1cf2595ee3a15a3e9131e87

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 AuthURL2.

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 on previously or who has an expired Ticket.

The returned values contain the values in the registry default specified in the Passport Manager Administration utility. To override the registry default values, use the overloaded AuthUrl2 methods, AuthUrl2(string,int,bool,string,int,string,int,bool) or AuthUrl2(string,int,int,string,int,string,int,int).

See Also

Passport PassportIdentity Object | PassportIdentity.AuthUrl2(string,int,bool,string,int,string,int,bool) | PassportIdentity.AuthUrl2(string,int,int,string,int,string,int,int)