asp.net mvc - Razor - @Html.Raw() still encoding & in meta tag attributes -



asp.net mvc - Razor - @Html.Raw() still encoding & in meta tag attributes -

when utilize @html.raw(mystring) normal renders example:

@{ viewbag.title = "my site&reg;"; } <title>@html.raw(viewbag.title)</title>

will render <title>my site&reg;</title> when utilize in attribute:

<meta name="description" content="@html.raw(viewbag.title)" />

it renders <meta name="description" content="my site&amp;reg;" /> not right because not render registered mark.

how right behavior?

as patridge pointed out in reply can include attribute markup in parameter .raw.

in case result in similar following:

<meta name="description" @html.raw("content=\"my site&amp;reg;\"") />

asp.net-mvc asp.net-mvc-3 razor asp.net-mvc-4

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -