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.