|
This problem is because there are HTML strings in the form you submit, for example, you enter html tags in the TextBox, or use the HtmlEditor component in the page, etc., the solution is to disable validateRequest. If you are .NET 4.0 or higher, be sure to look at Method 3. This method works in both asp.net webForms and MVC Method 1:Add this sentence to the header of the .aspx file: - <%@ Page validateRequest="false" %>
Copy code Method 2:Modify the web.config file: - <configuration>
- <system.web>
- <pages validateRequest="false" />
- </system.web>
- </configuration>
Copy codeBecause validateRequest defaults to true. Just set it to false.
Method 3:web.config - <system.web>
- <httpRuntime requestValidationMode="2.0" />
- </system.web>
Copy codeBecause 4.0 validation is enabled before HTTP BeginRequest, the validation of the request applies to all ASP.NET resources, aspx pages, ashx pages, web services, and some HTTP handlers, etc.
|