PassportIdentity.AuthUrl(string)
PassportIdentity.AuthUrl(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 does not take advantage of the Microsoft® .NET Passport authentication capabilities that are built into Microsoft® Windows® XP. The AuthURL2 method does use this functionality. For more information, see PassportIdentity.AuthURL2.
Syntax
public string AuthUrl(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 AuthUrl(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) + "</DIV>"); if (oMgr.GetIsAuthenticated(3600,false,false)) { //Display the AuthUrl return value. Response.Write ("<br>AuthUrl = " + oMgr.AuthUrl(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 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 AuthUrl 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