I have a string returned from a 3rd party API, that contains fully formed anchor tags (on most occasions). The html appears to be fully formed and correct.
I want to decode this and output into an MVC view as a valid anchor tag, however HTMLDecode does not seem to convert the anchor tag into a link.
I am simply outputting the text as such;
<p>@HttpUtility.HtmlDecode(Model.Description)</p>
but the text comes out with anchor tag included, like this;
This is a test description. Check here - <a href="http://query.nytimes.com/gst/fullpage.html?res=9F0DE2D81E3CF936A25753C1A9669C8B63&sec=&spon=&pagewanted=all">New York Times</a> for more information
Am I expecting to much of HtmlDecode?
Use @Html.Raw()
<p>@Html.Raw(Model.Description)</p>
http://msdn.microsoft.com/en-us/library/gg480740%28v=vs.118%29.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.