斜杠(/)与在asp.net样式表的路径波浪斜线(〜/) [英] slash(/) vs tilde slash (~/) in style sheet path in asp.net

查看:324
本文介绍了斜杠(/)与在asp.net样式表的路径波浪斜线(〜/)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将这些2路在asp.net中得到解决。
为什么这些2给出了不同的道路。什么时候,我们需要去这些。

How these 2 paths are resolved in asp.net. why these 2 gives different path. At what time we need to go for these.

<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)

按我的知识重新〜presents根应用程序的目录
共同,是根据在IIS网站(名为testsite.demo)的根文件夹

As per my knowledge ~ represents root directory of the application "Common" is the folder under root of the website(named testsite.demo) in IIS

物理路径= D:\\ Physicalpath \\ WarpFirstSite \\ testsite.demo
常见的文件夹位置 - D:\\ Physicalpath \\ WarpFirstSite \\ testsite.demo \\共同

推荐答案


  • / - 站点根目录

  • 〜/ - 应用程序的根目录

  • / - Site root
  • ~/ - Root directory of the application
  • 不同的是,如果网站是:

    The difference is that if you site is:

    http://example.com
    

    和你有一个应用程序的myapp <​​/ code>:

    And you have an application myapp on:

    http://example.com/mydir/myapp
    

    / 将返回站点的根目录( http://example.com ),

    / will return the root of the site (http://example.com),

    〜/ 将返回应用程序的根目录( http://example.com/mydir/

    ~/ will return the root of the application (http://example.com/mydir/).

    这篇关于斜杠(/)与在asp.net样式表的路径波浪斜线(〜/)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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