MVC4
razor view. Given that a string backgroundImage
is set like this:
backgroundImage = string.Format("background: url('{0}') top left no-repeat;", project.MainImage);
Why does this
<div class="spotlight slide teaser-text" id="@slideId" style="@Html.Raw(backgroundImage)">
produce
<div class="spotlight slide teaser-text" id="spotlight-0" style="background: url('/media/215/spotlight01.jpg') top left no-repeat;">
Html.Raw
, new MvcHtmlString
and MvcHtmlString.Create
all behave similarly.
I would expect it to produce
<div class="spotlight slide teaser-text" id="spotlight-0" style="background: url('/media/215/spotlight01.jpg') top left no-repeat;">
(note the quotes).