我在写一个问题,问为什么@Href 不能正确识别路径。
例如
@helper CSS(string cssFile, string media = "screen") {
<link href="@Href("~/content/stylesheets/" + @cssFile)" rel="stylesheet" type="text/css" media="@media" />
}
正在抛出 sereval js 404 错误,试图在其中找到资源
- http:// 本地主机/内容
- http://localhost/仪表板/内容
从来没有我想要的:
- http://localhost/MySite/内容
所以他们我发现了有趣的部分:@Url.Content
而不是@Href
正常工作!为什么!?
因此这不是更大的问题,问题在于 App_Code @Url 在上下文中不存在。那我可以用什么。