gpt4 book ai didi

asp.net - ASP.NET 中的相对路径

转载 作者:行者123 更新时间:2023-12-04 00:36:34 26 4
gpt4 key购买 nike

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

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

最佳答案

确实奇怪的实现,但不幸的是,这是 ASP.NET 处理这个的方式。这是我做的补偿:

<script src="<%=ResolveClientUrl("~/js/googleAnalytics.js")%>"></script>

关于asp.net - ASP.NET 中的相对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5207776/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com