如何使用ASP.NET授权然而,允许访问到.css文件? [英] How to use ASP.NET Authorization Yet Permit Access to .css Files?
问题描述
<authentication mode="Forms">
<forms loginUrl="Login.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
我使用窗体身份验证,当我把上面提到的参数,CSS格式我为整个文档做的是没有得到执行,它的消失。我应该怎么做,这样的CSS保持不变。
I am using forms authentication, and when i place the arguments cited above, the css formatting I have done for the whole document is not being implemented, it's vanishing. what should i be doing so that the CSS remains intact.
推荐答案
我假设你的登录表单有一个外部CSS文件,并且你正在使用卡西尼或IIS 7集成模式。
I assume that your login form has an external CSS file, and that you're using Cassini or IIS 7 integrated mode.
您&LT;拒绝用户= /&GT?;
是preventing匿名用户看到的登录表单的CSS文件。
Your <deny users="?"/>
is preventing anonymous users from seeing the login form's CSS files.
您需要使用&LT;地点&gt;
元素允许匿名用户看到CSS文件,像这样的:
You need to use the <location>
element to allow anonymous users to see the CSS files, like this:
<location path="CSS">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
这篇关于如何使用ASP.NET授权然而,允许访问到.css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!