加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET中的相对路径

发布时间:2020-12-15 22:51:39 所属栏目:asp.Net 来源:网络整理
导读:head runat="server" meta charset="UTF-8" / titleMake Games with Scirra Software/title meta name="description" content="Game making with Construct." / meta name="keywords" content="game maker,game builder,html5,create games,games creator" /
<head runat="server">
    <meta charset="UTF-8" />
    <title>Make Games with Scirra Software</title>
    <meta name="description" content="Game making with Construct." />
    <meta name="keywords" content="game maker,game builder,html5,create games,games creator" />
    <link rel="stylesheet" href="~/css/default.css" />
    <link rel="stylesheet" href="~/plugins/coin-slider/coin-slider-styles.css" />
    <link rel="shortcut icon" href="~/images/favicon.ico" />
    <link rel="apple-touch-icon" href="~/images/favicon_apple.png" />
    <script src="~/js/googleAnalytics.js"></script>
</head>

呈现为:

<head>
    <meta charset="UTF-8" />
    <title>Make Games with Scirra Software</title>
    <meta name="description" content="Game making with Construct." />
    <meta name="keywords" content="game maker,games creator" />
    <link rel="stylesheet" href="../css/default.css" />
    <link rel="stylesheet" href="../plugins/coin-slider/coin-slider-styles.css" />
    <link rel="shortcut icon" href="../images/favicon.ico" />
    <link rel="apple-touch-icon" href="../images/favicon_apple.png" />
    <script src="~/js/googleAnalytics.js"></script>
</head>

为什么JavaScript URL?/而不是../?

解决方法

确实是奇怪的实现,但遗憾的是ASP.NET处理这个方式.这是我做的补偿:
<script src="<%=ResolveClientUrl("~/js/googleAnalytics.js")%>"></script>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读