. Net4.0 ashx page Error: A potentially dangerous request.form value was detected

Source: Internet
Author: User

Original address: http://zzhi191.blog.163.com/blog/static/1350849520111116518067/

Web development is inevitably more than Ajax technology.

We handle AJAX background pages in ASP. Some people like to use ASPX pages, others like to use ashx pages, compared to the latter processing faster.

But when your environment is. NET 4.0, and the parameters submitted in Ajax happen to have special characters, such as Name=

This will cause an error: A potentially dangerous request.form value has been detected.

At this point we need to modify the Web. config file to add code within the <system.web></system.web> node as follows:

Let the validation mode be. NET 2.0 mode, then ASHX will not error.

Because the validation of 4.0 is enabled before HTTP beginrequest, the requested validation applies to all ASP. NET resources, ASPX pages, ashx pages, Web services, and some HTTP handlers.

Of course, if it is in the ASPX page to report this error is the page header and validation properties, very simple, Google query.

If someone asked some special characters in Ajax how to upload to the background ashx page. For example ABC.ASPX?NAME=AS&CD the name value here is AS&CD instead of as this issue can be viewed in my other blog click here to view

. Net4.0 ashx page Error: Potentially dangerous Request.Form value detected (RPM)

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.