Set up a public page in Windows Authentication protected website

This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.

If all of the pages in your website is protected by Windows Authentication, use the configuration to enable public access to certain pages.

 

The idea is to protect the entire website and create an exception for the public page. Here are the steps:

  • Enable Windows Authentication and disable Anonymous Authentication (This is how the Windows Authentication should be set - Anonymous Authentication should be disabled)
  • In the web.config file, use location tag to allow Anonymous access to a certain page:

 

 

<configuration> <system.web> <authorization> <allow users="*" /> <deny users="?" /> </authorization> </system.web> <location path="test”> <system.webServer> <security> <authentication> <anonymousAuthentication enabled="true" /> </authentication> </security> </system.webServer> </location> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>

 

 

This configuration allows anonymous access to the test folder.

 

Set runAllManagedModulesForAllRequests parameter to true for making sure the managed modules process all requests.

 

The page may throw an error about not being able to override the authentication settings. If you run into this issue, go to applicationHost.config file and set overrideModeDefault to Allow.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.