ASP. NET detects three potentially dangerous request. form values from the client,

Source: Internet
Author: User

ASP. NET detects three potentially dangerous request. form values from the client,

When the page is edited or submitted, the "request. form value detected from the client" problem occurs. What should I do? As shown in:

The following bloggers summarize several solutions to this problem:

Cause: In asp.net, when a Request is submitted with a string such as html code or javascript, the program system determines that the Request has a potentially dangerous value. An Error such as "Request. Form value detected from the client" is reported in the Environment configuration.

1. Add code on the current submission page

Open the current. aspx page and add the code validateRequest = "false" to the page header, for example:
Copy codeThe Code is as follows:
<% @ Page Language = "C #" ValidateRequest = "false" AutoEventWireup = "false" CodeFile = "default. aspx. cs" %>

2. Modify the web. config configuration file globally (this operation is not recommended or secure)
Open the web. config file and add the following code in the middle of <system. web> </system. web>:
Copy codeThe Code is as follows:
<Pages validateRequest = "false"/>

3. Another solution:The reason is that the passed value contains a special dangerous symbol. Therefore, you can use the Server before the transfer. htmlEncode (string) method to encode the string. This will escape dangerous characters into common characters. For example, TextBox1.Text = Server. HtmlEncode (str );

Related Article

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.