About how the ashx program in NET solves the validateRequest Error

Source: Internet
Author: User

As we all know, it is worth adding "validateRequest = false" to the header of the aspx page or adding it to the web. config configuration file. This can solve the problem.

However, there is another case where the client submits the data to the server's ashx page through ajax to process the data. If the submitted data contains the data, an error is also reported, for example, when you configure the Statistical Code or advertisement code on the backend of a website configuration information, it will certainly contain the javascrip tag. So how can we solve this problem? I tried to add it to the configuration file but it does not work. Of course, the first solution cannot be implemented at all.

I thought, maybe there will be a function similar to validateRequest = false ON THE ashx page, but it still cannot be found. If any readers find it, let me know.

Here, I want to talk about another method. This method does not implement the validateRequest = false function, but bypasses this verification. So how can we bypass it is actually very simple. First on the client, replace "with other characters (usually uncommon Chinese characters, such as 'signature'), and then use context on the server ashx page. the request function obtains all replaced strings and replaces them with the opposite method, that is, it replaces the complex characters with "" and stores them in the database, of course, this problem does not occur when reading data from the server to the client.

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.