ASP.NET成员资格:拒绝用户阻止了CSS,页面无法正确呈现? [英] ASP.NET Membership: CSS being blocked by Deny users, page doesn't render correctly?

查看:114
本文介绍了ASP.NET成员资格:拒绝用户阻止了CSS,页面无法正确呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面正常运行,但是当我向整个站点发出拒绝用户通知时,它会将我重定向到似乎可以正常工作的登录页面,但css无法正常工作.因此没有样式.

I have a page that functions correctly but when i issue a deny user for the whole site it redirects me to the logon page which seems to work BUT the css is not working. Hence there is no styling..

任何人都可以帮忙吗?我的web.config就是这样

Can anyone help? My web.config is like so

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>

此登录页面使用site.master具有以下样式表,但如果包含上述样式表,则无法为文档设置样式

This logon page uses a site.master has the following style sheet but fails to style the document when the above is included

 <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />

要确认我是否删除了web.config中的上述部分,然后它起作用了,因此包含了css并具有样式化

To confirm i i remove the part above in web.config then it works hence the css is included and beng styled

我认为这可能与CSS被拒绝有关..所以我包括了以下内容,但没有区别.我知道site.master会在登录页面中呈现,因为我看到了标题等.

I thought it might be something to do with the css being denied .. so i included the following but it makes no difference. I know the site.master is being rendered in the logon page because i see the headers etc..

 <location path="~/Content">
   <system.web>
     <authorization>
       <allow users="*" />
     </authorization>
   </system.web>
 </location>

我还在firefox中使用firebug来查看css,如果web.config中包含了授权标签,则说明没有CSS.如果删除标签,则可以看到CSS,并且页面显示正确.

I have also used firebug in firefox to view the css, if the authorization tags are included in web.config then it states there is no CSS. If i remove the tags then i can see the css and the page is rendered correctly.

我一定很想念东西.任何帮助表示赞赏

I must be missing something. Any help really appreciated

预先感谢

编辑

提琴手声明site.css已移动?

Fiddler states that the site.css is moved??

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>

对象已移到此处.

推荐答案

尝试删除位置的path属性中的代字号(〜).如果您查看提琴手的结果,则它是对CSS的回调请求.因此对该页面的未经身份验证的请求反过来又对资源(css)发出了未经身份验证的请求.

Try removing the tilda (~) in your location's path attribute. If you look at the fiddler result, its a callback request for your css. so the unauthenticated request for the page is in turn making unauthenticated requests for resources (the css).

我通常会尝试将样式目录放置在应用程序的根目录下,然后使用

I generally try to place a styles directory at the root of the application, and then use a helper tool like T4MVC or my own helper methods to translate and avoid having to figure out the ../../ directory crawling.

这篇关于ASP.NET成员资格:拒绝用户阻止了CSS,页面无法正确呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆