ASP.NET中的相对路径

前端之家收集整理的这篇文章主要介绍了ASP.NET中的相对路径前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<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>
原文链接:https://www.f2er.com/aspnet/249669.html

猜你在找的asp.Net相关文章