Request Validation in ASP.NET | Microsoft Docs[
^]
To disable request validation for a specific WebForms page, set the
ValidateRequest
property to
false
:
<%@ Page ValidateRequest="false" %>
To disable it for a specific control, set
the ValidateRequestMode
property[
^] on that control:
<asp:TextBox id="txtBody" runat="server" ValidateRequestMode="Disabled" />
For MVC, use
[ValidateInput(false)]
on the action, or
[AllowHtml]
on the model property.
For code which directly accesses the form/querystring collections, use
Request.Unvalidated().Form
or
Request.Unvalidated().QueryString
to retrieve the values without triggering the request validation.