I use the Html.Raw to print a raw html content, for example when I send some thing like ViewBag.div = "<div> Hello </div>";
from the controller to the view side it does not print a raw html content unless I use the Html.Raw
method but if I have an encoded content, like content encoded using jquery and inserted into the database and I want to print it as a raw html content the Html.Raw
method does not work and I have to use HttpUtility.HtmlDecode(EncodedContent)
before I use Html.Raw
so please could anyone explain why it acts in this way and what is the proper situation to use Html.Raw
method? or in another way, why Html.Raw
does not work when it receives html entities as a parameter instead of html tags?.