mar*_*ith 8 asp.net asp.net-mvc asp.net-membership
我有一个正常运行的页面但是当我为整个站点发出拒绝用户时,它会将我重定向到登录页面,这似乎有效但但css不起作用.因此没有造型..
有人可以帮忙吗?我的web.config是这样的
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
Run Code Online (Sandbox Code Playgroud)
此登录页面使用site.master具有以下样式表,但在包含上述内容时无法设置文档的样式
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
要确认ii删除web.config中的上面的部分然后它工作,因此包括和beng样式的CSS
我认为它可能与css被拒绝有关..所以我包括以下但它没有任何区别.我知道site.master正在登录页面中呈现,因为我看到了标题等.
<location path="~/Content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
我也在firefox中使用firebug来查看css,如果授权标签包含在web.config中,那么它表示没有CSS.如果我删除标签,那么我可以看到CSS和页面正确呈现.
我肯定错过了什么.任何帮助真的很感激
提前致谢
编辑
Fiddler声称site.css被移动了?
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=utf-8
Location: /InmoCasaWebClient/Account /LogOn?ReturnUrl=%2fInmoCasaWebClient%2fContent%2fSite.css
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Aug 2010 17:19:12 GMT
Content-Length: 201
<html><head><title>Object moved</title></head><body>
Run Code Online (Sandbox Code Playgroud)
使用fiddler查看该资源究竟发生了什么?可能会揭开神秘面纱.如果它是未经授权的,它应该403.可能是404ing?如果它不在虚拟目录中,您可以写:
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
(目录遍历很脆弱)
更新 - 现在更多信息
好的小提琴使用;)无论如何,因为它是302ing(临时重定向)您的CSS文件要求验证,问题是您的表单身份验证.
您可能遇到runAllManagedModuleForAllRequest ="true"问题.阅读该帖子了解相关信息.
或者设置对Content文件夹的所有访问权限以允许访问.你几乎就在那里,但它需要是:
<location path="Content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9066 次 |
| 最近记录: |