PassportIdentity.AuthenticationType
PassportIdentity.AuthenticationType
Gets the type of authentication used to identify the user.
Syntax
public string AuthenticationType [get]
Property value
A string, "Passport", indicating the authentication type provided by this authentication module.
Example
The following C# example displays the value of the AuthenticationType for the authenticated user.
<%@ 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 AuthenticationType if (oMgr.GetIsAuthenticated(3600,true,false)) { //Display the AuthenticationType for the authenticated user. Response.Write ("<br>You are authenticated."); Response.Write ("<br>The AuthenticationType: " + oMgr.AuthenticationType); } else { Response.Write ("You are not authenticated. Please click Sign In or exit."); } %>
Output for an authenticated user is similar to the following:
You are authenticated. The AuthenticationType: Passport
Remarks
A read-only property. The AuthenticationType is specified in the web.config file and is duplicated here:
<authentication mode="Passport"/>
The AuthenticationType property identifies the authentication type implemented by this authentication module. This value is an enumerated type and contains values that describe authentication methods used for inter-server connections. The authentication type is passed to the common language runtime by the operating system or by another authentication provider. Basic authentication, NTLM, Kerberos, and Passport are examples of authentication types. For PassportIdentity objects, the authentication type is typically Passport.
See Also
Passport PassportIdentity Object | PassportIdentity.GetIsAuthenticated