Allow anonymous access to Content and Script folder
I am building a ASP.NET MVC 2 website that uses Forms authentication. Now I want to allow unauthenticated users access to the Scripts and Content folders, so the stylesheets and images will load. However, it does not work. From what I found on Google, this should work:
<location allowOverride="false" path="Content">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
<location allowOverride="false" path="Scripts">
<system.web>
<authorization>
<allow users="?" />
</authorization>
开发者_C百科 </system.web>
</location>
It does not work in ASP.NET MVC 2 on IIS (win7). The stylesheet and javascript requests are redirected to Account/LogOn. How do I fix this?
Update: Anonymous Authentication is enabled in IIS. So is forms authentication.
Don't use the Authorization tags in the web.config. Use the Authorization attribute in your Controllers (or Actions).
精彩评论