Potentially dangerous Request.Form value detected from the client [workaround]

Source: Internet
Author: User

What do I do when the page edits or runs the submission with a "potentially dangerous Request.Form value detected from the client" issue? As shown in the following:

There are several workarounds for this error in the following blog Master summary:
Cause of the problem: because in ASP. NET, when a request commits a string such as HTML code or JavaScript, the program system considers it a potentially dangerous value. The environment configuration will report an error such as "potentially dangerous Request.Form value detected from the client".
1, the current submission page, add code
Open the current. aspx page, with the header plus code: validaterequest= "False", such as:

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

2. Modify the Web. config configuration file globally (this is not recommended, unsafe)
Open the Web. config file, and in the middle of <system.web></system.web>, add the following code:

<pages validaterequest= "false"/>

If neither of these methods can be resolved, then look down,

Problem reason: Because your current. NET Ifreamwork Framework environment is 4.0

3. Similarly, open the Web. config configuration file, in the middle of <system.web></system.web>, plus the code:

4, if your website program itself is NET 2.0 environment development, but put in the VS2010 software run, also will appear this situation, you can switch the operation solution to net2.0 can, replacement method see page 3rd step: Click to enter

5, another method of treatment: The reason is that the value of the message contains a special danger symbol, then you can use the Server.HTMLEncode (string) method before transmitting, the string is encoded, so that the dangerous word escapes to ordinary characters. such as Textbox1.text=server.htmlencode (str);

Learn more, refer to Microsoft Web page: http://www.asp.net/whitepapers/request-validation

Later found that the original 3 years ago, the solution to this problem has a brief summary, but not so comprehensive, it seems that experience can let people grow is right, there is a summary of this issue article: VS2005 Debugging Problem Solution Collection

Potentially dangerous Request.Form value detected from the client [workaround]

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.