Is this a bug? Or is it a setting in ASP.NET 4 (or MVC 2)?
- by John Gietzen
I just recently started trying out T4MVC and I like the idea of eliminating magic strings.
However, when trying to use it on my master page for my stylesheets, I get this:
<link href="<%: Links.Content.site_css %>" rel="stylesheet" type="text/css" />
rending like this:
<link href="<%: Links.Content.site_css %>" rel="stylesheet" type="text/css" />
Whereas these render correctly:
<link href="<%: Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css" />
<link href="<%: Links.Content.site_css + "" %>" rel="stylesheet" type="text/css" />
It appears that, as long as I have double quotes inside of the code segment, it works. But when I put anything else in there, it escapes the leading "less than".
Is this something I can turn off? Is this a bug?
Edit:
This does not happen for <script src="..." ... />, nor does it happen for <a href="...">.
Edit 2:
Minimal case:
<link href="<%: string.Empty %>" />
vs
<link href="<%: "" %>" />