Asp.net mvc. Display html string from database

I need to display data from a database containing strings like & or & When I try to display it through Html.Raw or Html.Encode, I have dublicates values, for example amp; for Html.Raw and also bad output for Html.Encode.

What should I do? I use Razor syntax.

Example line: Hello, my name is Junior & I hate & laquo; bugs & raquo; .

+4
source share
1 answer

According to the comments at the top:

@Html.Raw(string) must be the correct syntax. Are you sure the string data in the database is not escaped yet?

+12
source

Source: https://habr.com/ru/post/1413036/


All Articles