XSS Attack
XSS Attack = Cross-site scripting attack
A user enters some malicious scripting code like below in one of the input fields on your website form.
in ASP.net, To avoid such XSS attacks, all MVC Controller's actions by default don't process the request and send back error if any HTML code is sent in the request.
In case you want some Controller action to allow HTML in the requests, use the decorator ValidateInput(false)
on the action method:
And in case you want to allow HTML for some specific field in a form instead of the whole Controller Action, use AllowHTML
at the property level in the Model of the data.
Last updated