views:

83

answers:

1

I created a simple CMS in 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?

+2  A: 

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

Levi