I have a snippet <h2>SomeText</h2>
When I saved in database from ckeditor change to it: <h2>SomeText</h2>
now when I am using @WebUtility.HtmlDecode alone it's not display correctly and change to it: &lt;h2&gt;SomeText&lt;/h2&gt;
So When I am using @Html.Raw alone it's not display correctly and chage to it: <h2>SomeText</h2>
Now:
I can't understand why did not work alone when I am using @Html.Raw or @WebUtility.HtmlDecode?
but when I am using First @WebUtility.HtmlDecode and next @Html.Raw together it's work correctly like it. @Html.Raw(WebUtility.HtmlDecode(@Item.Content))
<h2>SomeText</h2> Stored in @Item.Content
Simply use
@Html.Raw("<h2>SomeText</h2>")
this will decode the encoded data to html and will store it in DB u r trying to decode and thn u r again encoding it thats the reason u getting the html encode data in DB