Monday, December 24, 2012

beat XSS attacks with Razor

This suggests that one may sanitize stuff that bubbles up to a view against being XSS vulnerable like so in Razor markup:

@Html.Encode(Model.MyMultilineTextField).Replace(@"\n", "<br />")

No comments:

Post a Comment