Display string as html in asp.net mvc view

后端 未结 5 1729
北恋
北恋 2020-12-01 04:22

I have a controller which generate string containing html markups.Now when I am displaying it on views, it is displayed as simple string containing all tags. I tried to u

5条回答
  •  [愿得一人]
    2020-12-01 04:44

    You are close you want to use @Html.Raw(str)

    @Html.Encode takes strings and ensures that all the special characters are handled properly. These include characters like spaces.

提交回复
热议问题