Search code examples
c#asp.netactive-directoryweb-configform-authentication

How to apply form authentication for some web pages


Please consider this scenario:

I have a project that it contains some web pages.I add form authentication based on Active Direcotry for my all web pages.For Example :

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

Now I want to exclude some pages from form authentication.How I can exclude some pages in web.config?

thanks


Solution

  • Put your page in a separate directory and modify the web.config accordingly.and You can do this also

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

    More discussions

    link1

    Excluding pages from forms auth - ASP.NET