authentication 元素(ASP.NET 设置架构)

配置 ASP.NET 身份验证方案,该方案用于识别查看 ASP.NET 应用程序的用户。

<authentication 
   mode="[Windows|Forms|Passport|None]"
> 
   <forms>...</forms>
   <passport/>
</authentication>

authentication 元素为 ASP.NET 应用程序配置 ASP.NET 身份验证方案。 身份验证方案确定如何识别要查看 ASP.NET 应用程序的用户。 mode 特性指定身份验证方案。 有关可用的身份验证方案的更多信息,请参见 ASP.NET Authentication



下面的代码示例演示如何为基于窗体的身份验证配置站点、指定传输来自客户端的登录信息的 Cookie 的名称以及指定当初始身份验证失败时使用的登录页的名称。 必须将 authorization 节包含在内才能要求对所有用户进行 Forms 身份验证,并拒绝匿名用户访问站点。

<configuration>
   <system.web>
      <authentication mode="Forms">
         <forms name="401kApp" loginUrl="/login.aspx"/>
      </authentication>
      <authorization>
         <deny users="?"/>
      </authorization>
   </system.web>
</configuration>
原文地址:https://www.cnblogs.com/gates/p/3110278.html