网站CSS中的ASP.NET根文件夹 [英] ASP.NET Root folder of website in CSS
问题描述
所以,我想我会尝试我的运气ASP.NET。我没有得到很远才找到我的第一个问题。
So, I thought I'd try my luck on ASP.NET. I didn't get very far before I found my first problem.
我有一个文件夹的布局,像这样:
I have a folder layout like so:
\
->Admin
-->Admin.Aspx
->CSS
-->Style.css
->Images
-->bg.gif
Default.aspx
Default.master
两者 admin.aspx
和 Default.aspx的
使用 default.master
页,其中包含该行:
Both admin.aspx
and default.aspx
use the default.master
page, which contains the line:
<link rel="stylesheet" type="text/css" href="CSS/Style.css" media="screen" />
本作品为 Default.aspx的
页,因为路径是有效的,但对于管理页面不是这样的。
This works for the default.aspx
page, because the path is valid, but for the admin page it's not.
有没有什么特殊的字符,比如〜家庭在Linux中,指示根路径?
托管时,我不能只用一个斜杠,因为该网站也许下一个子文件夹中。
Is there any special character, like ~ for home in Linux, to indicate the root path? I can't use just a slash, because the website maybe under a sub folder when hosted.
希望我已经解释了自己,所以你能理解我需要做的:)
Hopefully I've explained myself so you can understand what I need to do :)
我想这是更多的HTML问题比ASP问题。
I guess it's more an HTML issue than an ASP issue.
推荐答案
如果你的&LT; HEAD&GT;&LT; /头&GT;
标记包含=服务器(这IIRC它在默认情况下),你可以简单地将它指定为:
If your <head></head>
tag contains runat="server" (which IIRC it does by default) you can simply specify it as:
<link rel="stylesheet" type="text/css" href="~/CSS/Style.css" media="screen" />
这篇关于网站CSS中的ASP.NET根文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!