XSS Prevention in ASP.NET — a practical guide to XSS prevention ASP.NET with clear examples you can reuse in real projects.
ASP & ASP.NET Tutorial Series (231/247). Prefer one article? Read the complete ASP.NET tutorial.
Short description
Razor encodes by default � be careful with Html.Raw. Defense only.
XSS prevention tip
Encode output
Avoid Html.Raw on user content
CSP headers
Sanitize rich text if required