Set up a public page in Windows Authentication protected website

  • Thread starter Thread starter Nedim
  • Start date Start date
N

Nedim

Guest
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.

Continue reading...
 
Back
Top