ASP. NET detects potentially dangerous data in requests because it may include HTML tags or scripts, asp.net requests
Solution:
Method 1. Modify the. aspx File
Add validateRequest = "false" to the. aspx file, for example:
<% @ Page validateRequest = "false" language = "c #" Codebehind = "WriteNews. aspx. cs" AutoEventWireup = "false"
Inherits = "News. WriteNews" %>
Method 2: configure the web. config file
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<System. web>
<! -- This statement must be added when WriteNews. aspx uses the content edit box. Otherwise, the Request value cannot be added.
-->
<Pages validateRequest = "false"/>
</System. web>
</Configuration>
Recommended method 1
However, the preceding settings are only valid for ASP. NET4.0 and later versions. In ASP. NET4.0, we need more configuration lines:
Set at the global level (in Web. config)
<Configuration>
<System. web>
<HttpRuntime requestValidationMode = "2.0">
This is explained on the page where an error occurs. In actual use, this is not only the case, but I also found that the requestValidationMode can be set to be smaller than 4.0, for example, 1.0, 2.0, 3.0, and 3.9, the error code 2.0 is specified in the error message to describe ASP. NET 2.0 by default.