user1399542
user1399542

Reputation: 51

asp.net mvc. Display html string from database

I need to display a data from a database which contains strings like & or «. When I try to display them through Html.Raw or Html.Encode, I've got dublicates values like & for Html.Raw and also bad output for Html.Encode.

What should I try? I use Razor syntax.

Example string: Hello, my name is Junior & I hate «bugs».

Upvotes: 4

Views: 6337

Answers (1)

user610217
user610217

Reputation:

As per the comments at the top:

the @Html.Raw(string) should be the proper syntax. Are you sure the string data in the database is not already escaped?

Upvotes: 12

Related Questions