Is this a bug? Or is it a setting in ASP.NET 4 (or MVC 2)?
Posted
by
John Gietzen
on Stack Overflow
See other posts from Stack Overflow
or by John Gietzen
Published on 2010-12-21T16:30:30Z
Indexed on
2010/12/21
16:54 UTC
Read the original article
Hit count: 244
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="<%: "" %>" />
© Stack Overflow or respective owner