How to prevent redirect to login for js files?
On my Login.aspx page, before the user is authenticated I need to run some javascript that is defined in a file. The javascript file doesn't seem to be found. I believe this is a problem caused from the user not being allowed to access this content and when the server attempts to download this file it is redirected to login. So I added this to my web.config开发者_如何学Python:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*" />
<deny roles="none"/>
</authorization>
</system.web>
</location>
However, still not working. I get redirected when I take the path to the js file and put it in URL, as well.
If you're using IIS 7 the reason can be the same as with CCS and image files. You will have to give access to IUSR Anonymous user account to your folder that contains your css or images or js files. Check this post for more info.
精彩评论