C# 如何对某些网页应用表单身份验证

C# 如何对某些网页应用表单身份验证,c#,asp.net,active-directory,web-config,form-authentication,C#,Asp.net,Active Directory,Web Config,Form Authentication,请考虑以下情况: 我有一个包含一些网页的项目。我为我的所有网页添加了基于Active Directry的表单身份验证。例如: <connectionStrings> <add name="ADConnectionString" connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdomain,DC=test,DC=com" /> </connectionStrings> <aut

请考虑以下情况:

我有一个包含一些网页的项目。我为我的所有网页添加了基于
Active Directry
的表单身份验证。例如:

<connectionStrings>
   <add name="ADConnectionString" connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdomain,DC=test,DC=com" />
</connectionStrings>
<authorization>
     <deny users="?" />      
</authorization>

现在我想从表单身份验证中排除一些页面。如何排除
web.config
中的一些页面


谢谢

一个简单的方法是在应用程序中为公共页面创建一个单独的文件夹。在该文件夹中,您可以放置要从身份验证中排除的所有页面。然后在该文件夹中放置一个web.config,其中仅包含身份验证设置,如下所示:

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
</configuration>

将您的页面放在一个单独的目录中,并相应地修改web.config。您也可以这样做

    <configuration>
       <location path="CreateAccount.aspx">
        <system.web>
         <authorization>
          <allow users="?"/>
         <authorization>
        </system.web>
      </location>  
   </configuration>


在这篇文章中,你可以找到你的回答:我不得不把它放在一个地方。