【发布时间】:2018-08-08 07:41:12
【问题描述】:
我如何才能获得要在视图上显示的绝对 URL?
我目前在我的代码中有这个:
<link href="~/css/site.min.css" rel="stylesheet" />
..显示如下:
<link href="/css/site.min.css" rel="stylesheet" />
我正在寻找的是以下内容:
<link href="http://www.example.com/css/site.min.css" rel="stylesheet" />
我知道您可以使用较旧的 ASP.NET MVC 5 来做到这一点,但核心版本可以做到这一点吗?
绝对 URL 值得吗,还是相对 URL 就足够了?
【问题讨论】:
-
在这种情况下,我真的不认为需要完整的 URL。
标签: asp.net asp.net-mvc razor asp.net-core