开发者

asp.net mvc and canonical link: bug?

I created a simple CMS 开发者_StackOverflowin asp.net MVC. Every article has a canonical link, which I want to use in my master page like this:

<link href="<%= Model.CanonicalLink %>" rel="canonical" />

However, when I view the source of this page in Firefox, it shows me:

<link href="../../Views/Shared/%3C%25=%20Model.CanonicalLink%20%25%3E" rel="canonical" />

I must be very stupid, or it is a bug. When I move the <%= Model.CanonicalLink %> part out of the <link /> then it shows me the canonical link. So, what is causing this odd behaviour?


This is the ASPX parser stomping on your HTML. Remove the runat="server" from the <head> element in which this <link> is defined.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜