Kya*_*avi 44 asp.net path relative-path stylesheet absolute-path
如何在asp.net中解决这两个路径.为什么这两个给出不同的路径.我们什么时候需要去做这些.
<link href="/common/black_theme/css/style.css" rel="stylesheet"> (this is working)
<link href="~/common/black_theme/css/style.css" rel="stylesheet"> (this is not working)
Run Code Online (Sandbox Code Playgroud)
据我所知〜表示应用程序的根目录"Common"是IIS中网站根目录下的文件夹(名为testsite.demo)
物理路径= D:\Physicalpath\WarpFirstSite\testsite.demo
公共文件夹位置 -D:\Physicalpath\WarpFirstSite\testsite.demo\common
Ode*_*ded 82
/ - 站点根目录~/ - 应用程序的根目录不同之处在于,如果您的网站是:
http://example.com
Run Code Online (Sandbox Code Playgroud)
你有一个应用程序myapp:
http://example.com/mydir/myapp
Run Code Online (Sandbox Code Playgroud)
/将返回site(http://example.com)的根,
~/将返回application(http://example.com/mydir/)的根.
如果您添加runat="server"链接标记,那么它将完美地工作....
像这样....
<link href="~/common/black_theme/css/style.css" rel="stylesheet" runat="server">
Run Code Online (Sandbox Code Playgroud)
(这也有效)
| 归档时间: |
|
| 查看次数: |
40981 次 |
| 最近记录: |