<authentication> Element

Configures ASP.NET authentication support. This element can be declared only at the machine, site, or application level. Any attempt to declare it in a configuration file at the subdirectory or page level will result in a parser error message.

**      <authentication>**

<authentication mode="Windows|Forms|Passport|None">
   <forms name="name"
          timeout="30" path="/" >
      <credentials passwordFormat="Clear|SHA1|MD5">
         <user name="username" password="password"/>
   <passport redirectUrl="internal"/>

Required Attribute

Attribute Option Description
mode     Controls the default authentication mode for an application.
    Windows Specifies Windows authentication as the default authentication mode. Use this mode when using any form of Microsoft Internet Information Services (IIS) authentication: Basic, Digest, Integrated Windows authentication (NTLM/Kerberos), or certificates.
    Forms Specifies ASP.NET forms-based authentication as the default authentication mode.
    Passport Specifies Microsoft Passport authentication as the default authentication mode.
    None Specifies no authentication. Only anonymous users are expected or applications can handle events to provide their own authentication.


Subtag Description
<forms> Configures an ASP.NET application for custom forms-based authentication.
<passport> Specifies the page to redirect to if the page requires authentication and the user has not signed on with Passport.


The following example configures a site for forms-based authentication, specifies the name of the cookie that transmits logon information from the client, and specifies the name of the logon page to use if initial authentication fails. You need to include an <authorization> section to require forms authentication by all users and to deny anonymous users access to the site.

      <authentication mode="Forms">
         <forms name="401kApp" loginUrl="/login.aspx"/>
         <deny users="?"/>


Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.AuthenticationConfigHandler

See Also

ASP.NET Configuration | ASP.NET Settings Schema