[HttpRequestValidationException (0x80004005): From the client... Potentially dangerous Request.Form value is detected in the Request.Form value. ] System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName)
1. In fact, the error has been clearly explained and the solution is told:
A potentially dangerous Request.Form value was detected from the client (txtUEditor="<p>a</p>").
Description: The request validation process detected potentially dangerous client input values and the processing of the request has been aborted. This value may indicate that there is an attempt to compromise the security of the application, such as a cross-site scripting attack. To allow the page to override the application request validation settings, set the requestValidationMode property in the httpRuntime configuration section to requestValidationMode="2.0". Example: <httpRuntime requestValidationMode="2.0" />. Once this value is set, <pages> request validation can be disabled by setting validateRequest="false" in the Page directive or in the configuration section. However, in this case, it is highly recommended that the application explicitly check all inputs. See http://Go.microsoft.com/fwlink/?LinkId=153133 for more information.
Exception details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (txtUEditor="<p>a"a</p>).
2. Another way is to set it in the Pages section in web.config, such as:
But this method is not good, too violent, because it will make all pages of the entire project no longer verify the submitted content, and the security is greatly reduced.
3. Recommended practices: Add an Attribute:[ValidateInput(false)] to the Action, which will only prevent the page from validating the submission, and not affect other pages.
Note: If Request.Form["XXX"] is obtained in this way, a potentially dangerous anomaly will still be detected, so be sure to put the data you want to obtain in the controller parameters! !
|