asp.net - 如何在 ASPX 母版页的 HEAD 中使用协议(protocol)相关 URL?

标签 asp.net

我正在尝试在母版页模板的头部引用以下 CSS。

<link rel="stylesheet nofollow" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />

但是,当它被渲染时,它会呈现为...

http://www.example.com/maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css

...这给了我一个 404。

正确的做法是什么?

最佳答案

您可能通过将 nofollow 添加到链接标记中而导致错误,请参阅此处

Do I need rel="nofollow" in external scripts and stylesheets?

编辑:根据OP评论进行更新

这似乎是旧版本 Visual Studio 的一个已知问题。对于初学者,您可以尝试以下操作

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />

这可能会产生另一个弹出窗口。如果是这种情况,您可以尝试设置文档格式(ctrl+K、ctrl+D),如果行结尾一致,Visual Studio 有时可以清除此错误。

引用:http://forums.asp.net/t/1176284.aspx?Could+not+edit+because+it+is+not+in+the+web+site+

如果这不起作用,那么您可以尝试按照此 SO 帖子 Visual Studio 2012 SP3 changing link href when using ASP.NET in design view 的建议来捆绑脚本。

最佳建议似乎是如果可能的话更新 Visual Studio。了解带有错误 VS2008 pre SP1 的 Visual Studio 版本

关于asp.net - 如何在 ASPX 母版页的 HEAD 中使用协议(protocol)相关 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25671623/

相关文章:

html - 移动到 site.css 时未应用样式

javascript - 如何在需要用户登录的母版页中隐藏和取消隐藏 asp.net 中的 CSS 子菜单?

asp.net - 如何在 ASP.NET MVC 中将 "active"类添加到 Html.ActionLink

asp.net - 为 Sitecore 配置故障转移合作伙伴

asp.net mvc Linq 排除其他表中的值

jquery - 公司不想使用 ASP.NET ajax...我该怎么办?

asp.net - "Could not load file or assembly ' X.dll ' or one of its dependencies. The specified module could not be found."- 在主机服务器上

c# - 如何在 ASP.NET 中使用 User.Identity.Name 作为 SqlDataSource 的参数?

c# - 当安全答案正确时,ASP.NET ResetPassword 抛出 MembershipPasswordException

javascript - 脚本链接中的@(at)符号导致异常