Freigeben über


PassportIdentity.LogoutURL(string,string,int,string,int)

PassportIdentity.LogoutURL(string,string,int,string,int)

Returns the Microsoft® .NET Passport logout URL string.

Syntax

public string LogoutURL(  string szReturnURL,  string szCOBrandArgs,  int iLangID,  string strDomain,  int iUseSecureAuth)

Parameters

  • szReturnURL
    Sets the URL of the location to which the Login server should redirect users after they sign out. Pass a null reference 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 root.
  • szCOBrandArgs
    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 Cobrand Args value specified in the Passport Manager Administration utility.
  • iLangID
    Specifies the language to be used for the Sign-out 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.
  • strDomain
    The domain authority for the user.
  • iUseSecureAuth
    Declares whether the actual sign-out user interface (UI) should be served HTTPS from the .NET Passport domain authority. Use 0 (false) to indicate that at least some of the .NET Passport pages have been served HTTP, or 1 (true) to indicate that the entire series of .NET Passport pages have been served HTTPS.  Use -1 to indicate that .NET Passport should use the default value of false.

Return values

Returns the URL of the appropriate network sign-out page as customized for the domain authority of the currently connected .NET Passport user.

Example

The following C# example displays both of the overloaded LogoutURL methods. The returned values for the LogoutURL methods are displayed.

<%@ 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)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>");

//Get and print the Ticket values
if (oMgr.GetIsAuthenticated(3600,true,false)){
 Response.Write ("<br>You are authenticated.");
 Response.Write ("<br><br>Your LogoutURL(), you will return to:<br>" +
  oMgr.LogoutURL());
 Response.Write ("<br><br>Your LogoutURL(sthisURL,null,1033,'passport-ppe.com',-1), you will return to:<br>" +
  oMgr.LogoutURL(sthisURL,null,1033,"passport-ppe.com",-1));
}
else {
 Response.Write ("You are not authenticated. Please click Sign In or exit.");
}
%>

If the user is signed in, the output may be similar to the following. The return URLs are slightly different. The first return URL is the value from the LogoutURL method with no parameters, which returns the value from the Passport Manager Administration utility. The second value is the LogoutURL method with the parameters specified in the preceding code.

You are authenticated.
Your LogoutURL(), you will return to:
https://current-login.passport-ppe.com/logout.srf?lc=1033&id=23248&ru=https://localhost/BriefCS/Default.aspx&lcid=1033&cb=co-brand-args

Your LogoutURL(sthisURL,null,1033,'passport-ppe.com',-1), you will return to:
https://current-login.passport-ppe.com/logout.srf?lc=1033&id=23248&ru=https://localhost/BriefCS/Exercise.aspx&lcid=1033&cb=co-brand-args

Remarks

If the szReturnURL is set to null, the registry default (the value set in the Passport Manager Administration utility) is used to determine the return URL. If both szReturnURL is null and the return URL value in the Passport Manager Administration utility is blank, the URL defined in the application's logout URL is used to specify the return URL for this method.

The iLangID is an integer representation of a standard locale ID (LCID). For example, U.S. English (EN/US) is 1033. For a table of LCIDs, see Localization and .NET Passport Services.

See Also

Passport PassportIdentity Object