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 @Html.Raw
in that modern browsers such as Chrome will allow an edit injection of <script>malicious()</script>
or even to change a form's post action to something else.
@Html.Raw
will allow executing any script that is on the value to display. If you want to prevent that you need to use @Html.AttributeEncode
Correct, the risk is in how it is used. There's no risk inherent in Html.Raw
. It's a tool, nothing more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With