Asp. NET 3 solutions for potentially dangerous request.form values from the client _ practical Tips

Source: Internet
Author: User

What to do when a page edits or runs a commit, and there is a "potentially dangerous Request.Form value detected from the client" issue? As shown in the following illustration:

There are several solutions to this error in the following blog Master summary:

Problem reason: Because in asp.net, when a request submits a string of HTML code or JavaScript, the program system thinks it has potentially dangerous values. The environment configuration will report an error such as "detects potentially dangerous request.form values from the client".

1, the current submission page, add code

Opens the current. aspx page with the header code: validaterequest= "False", such as:

Copy Code code as follows:

<%@ Page language= "C #" validaterequest= "false" autoeventwireup= "false" codefile= "Default.aspx.cs"%>

2, the global modification Web.config configuration file (this does not recommend, unsafe)
Open the Web.config file, and in the middle of <system.web></system.web>, add the following code:
Copy Code code as follows:

<pages validaterequest= "false"/>

3, another way to deal with:The reason is that the transmitted value contains a special dangerous symbol, so you can encode the string using the Server.HTMLEncode (string) method before passing it, which will escape the dangerous word as a normal character. such as Textbox1.text=server.htmlencode (str);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.