PassportAuthentication Class
Assembly: System.Web (in system.web.dll)
The PassportAuthentication class allows you to access and configure a node in the Machine.config or Web.config configuration file identified by the passport tag.
This type is part of a group that includes the AuthenticationSection, FormsAuthenticationConfiguration, and AuthenticationMode types.
Note: |
|---|
|
The PassportAuthentication class can write information into the related section of the configuration file at machine, site, or application level only. Any attempt to write in a configuration file at a different level in the hierarchy will result in an error message generated by the parser. You can use this class to read configuration information at any level in the hierarchy. |
The following code example shows how to obtain the PassportAuthentication object from the configuration file of an existing Web application. Also shown is a configuration example.
<authentication> <passport redirectUrl="Login.aspx"/> </authentication>
// Get the configuration. // Get the Web application configuration. System.Configuration.Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the section. System.Web.Configuration.AuthenticationSection authenticationSection = (System.Web.Configuration.AuthenticationSection)configuration.GetSection("system.web/authentication"); // Get the authentication passport element. PassportAuthentication passport = authenticationSection.Passport;
System.Configuration.ConfigurationElement
System.Web.Configuration.PassportAuthentication
Note: