Is there a risk in using @Html.Raw?

后端 未结 3 649
梦毁少年i
梦毁少年i 2021-01-18 11:18

Is there a risk in using @Html.Raw? It seems to me there shouldn\'t be. If there is a risk then wouldn\'t that risk already exist regardless of using @Htm

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 11:53

    If you are displaying user entered information it is better to use @Html.Encode().

    In another words, if you are displaying non-user eneterd data you are safe to go with @Html.Raw()

提交回复
热议问题