Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Html.Raw used as attribute value in Razor is still being encoded [393]

$
0
0
Steps:
* Load an MVC 4 project.
* Go into a view (e.g., ~/Views/Shared/_Layout.cshtml).
* Add an attribute to an HTML element and make its value something that is already attribute-encoded and wrapped in `@Html.Raw`.
* Run site and find the title attribute is encoded, despite being run through `@Html.Raw`.

Example:
<a title="@Html.Raw("Show Size 6½-8")">Test1</a>

Expected:
<a title="Show Size 6½-8">Test1</a>

Actual (doubly-encoded somehow):
<a title="Show Size 6½-8">Test1</a>

[Original Stack Overflow question: http://stackoverflow.com/q/12321616/48700]
Comments: verified.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>