Asp.NET没有申请我的CSS文件 [英] Asp.NET not applying my CSS files
问题描述
我的网站位于文件夹中的 /网站
My site located in folder /website
在浏览器中打开它通过网址的http://本地主机:52912 /网站/
In browser it opens by url http://localhost:52912/website/
我的默认页AMD母版页都位于根目录下
My Default page amd master page both located in root catalog
在我的Default.aspx包括我的母版页这样的:
in Default.aspx i include my master page like:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="WTF.master" %>
在我WTF.mater我包括CSS文件:
In my WTF.mater i include css file:
<link href="~/css/reset.css" runat="server" rel="stylesheet" type="text/css" media="screen" />
当我运行的网站,并期待他的源$ C $ C在Mozilla中,我看到的CSS文件链接:
when i run the site and look his source code in mozilla, i see css file link as:
<link href="css/reset.css" rel="stylesheet" type="text/css" media="screen" />
所以,完整的URL将是的http://本地主机:52912 /网站/ CSS / reset.css
这是正确的。
-css文件存在
-No像404未找到 - reset.css萤火误差
-No errors in firebug like "404 not found - reset.css"
调试项目时 - 无误差
-No errors when debugging project
我甚至无法通过直接链接在浏览器中打开此文件(的http://本地主机:52912 /网站/ CSS / reset.css
)或链接Mozilla源码code观众
I can't even open this file by direct link in browser ( http://localhost:52912/website/css/reset.css
) or by link in mozilla source code viewer
它返回的http://本地主机:52912 /网站/ Default.aspx的RETURNURL =%2fcss%2freset.css
我仍然在同一页面上
It returns http://localhost:52912/website/default.aspx?ReturnUrl=%2fcss%2freset.css
and i remains on the same page
我尝试了一大堆的各种组合和建议,从谷歌 - 没有什么帮助。
I tried a whole bunch of various combinations and advices from google - nothing helps
什么..?
解决:
通过添加
<location path="css">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
在web.config中
in web.config
推荐答案
这是因为你有窗体身份验证打开,并且您已经不允许了 CSS
文件夹公共访问。尝试添加该到Web.config:
That's because you have forms authentication turned on and you haven't allowed that css
folder public access. Try adding this to the web.config:
<location path="css">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
这篇关于Asp.NET没有申请我的CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!