Css只在视觉工作室设计视图中工作 [英] Css only working in visual studio design view

查看:85
本文介绍了Css只在视觉工作室设计视图中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好吧

我正在使用Visual Studio 2010和IIS7中的Web应用程序。出于某种原因,CSS只能在visual studio中正常工作。我可以在页面的设计视图中看到CSS。当我在localhost上查看页面时,CSS没有被应用。

有人可以帮助我吗?



我想了解这个的原因问题。

web.config中的这段代码造成了我的问题。

Hi every body
I'm working on a Web Application in Visual Studio 2010 and IIS7. For some reason the CSS only works properly inside visual studio. I can see the CSS inside the design view of the page. When I view the page on localhost the CSS is not being applied.
can anyone help me?

I think understood the cause of this problem.
this code in web.config has created my problem .

<authentication mode="Forms">
        <forms loginUrl="Login.aspx" />
    </authentication>
 <authorization>
     <deny users="?"/>
 </authorization>



当我登录页面时没有显示样式但是当我登录时默认页面工作正常。

当我按下后面密钥,登录页面也运行良好。

我该怎么办?

但是,当我删除下面的代码时,一切运行良好。


When I am on the login page style is not displayed but when I logged in the default page is working properly.
When I press the back key ,login page also works well.
What should I do?
However, when I remove the code below everything works well.

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



最好的问候


best regards

推荐答案

验证CSS有已正确加载,已使用正确的路径。您可能还需要清除浏览器缓存以防万一发生冲突。如果您使用的是IE,您可以使用开发人员工具栏查看实际加载的脚本和CSS。
Verify the CSS has been loaded properly, the correct path has been used. You may also need to clear the browser cache just in case there is a conflict. If you are using IE you can use the Developer Toolbar to look at what scripts and CSS is actually loaded.


除了Mark的回答:



您最终可以从客户端找到或不找到什么资源。加载页面,使用查看页面源并找到CSS的URL(或其他任何内容)。它看起来是正确的,转到地址行并修改以直接加载该资源。将找到此页面。从那时起,你知道在哪里找到一个bug。



-SA
In addition to the answer by Mark:

You can ultimately what resource is found or not from the client side. Load the page, use "View Page Source" and locate the URL for CSS (or what ever else). It it looks correct, go to the address line and modify to load that resource directly. This page will be found or not. From that point, you know where to find a bug.

—SA


我知道这篇文章已经开放了一段时间,但我遇到了同样的问题,并且由于fika_fa的研究,我至少能够找到并解决问题。



拒绝用户访问站点的授权也拒绝在受限制的文件夹中加载资产。所以在我的例子中,样式表位于一个名为css的文件夹中。这意味着我需要向web.config添加授权配置,以允许匿名用户能够访问它,从而能够加载样式表。



在web.config中的system.web部分之后,我添加了以下行:



I know this post has been open for a while, but I had the same problem and due to the research by fika_fa, I was able to identify and solve the problem at least for me.

The authorization that denies users access to the site also denies the loading of assets in folders that are restricted. So in my case the stylesheet was located in a folder called css. This meant that I needed to add an authorization configuration to the web.config to allow anonymous users to be able to access it, thus being able to load the stylesheet.

After the system.web section in the web.config I added the following lines:

<location path="css">

    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>

  </location>







这解决了我的问题,希望如果你来到这里并且上述解决方案没有帮助,这将对你有所帮助。



http://weblogs.asp.net/gurusarkar/archive/2008/09/29/setting-author ization-rules-for-a-page-or-folder-in-web-config.aspx [ ^ ]是一篇文章关于如何配置web.config




This solved the problem for me and hopefully if you came here and the above solutions didn't help this will help you.

http://weblogs.asp.net/gurusarkar/archive/2008/09/29/setting-authorization-rules-for-a-particular-page-or-folder-in-web-config.aspx[^] is an article about how to configure the web.config


这篇关于Css只在视觉工作室设计视图中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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