取消对IIS 7中使用的HttpHandler请求验证IIS、HttpHandler

2023-09-03 02:59:57 作者:玛丽莲梦兔

我有了处理得到特字在其网址(如:放;, +,%等)的应用程序。当我使用这些字符(当然,我把他们逃脱)我收到错误的请求响应code与消息发送请求到应用程序ASP.NET检测URL中的无效字符 。跟踪请求指示我的错误是从验证模块抛出。

I have an application that has to deal with getting "special" characters in its URL (like &, +, %, etc). When I'm sending a request to the application using these characters (of course I'm sending them escaped) I'm getting "Bad Request" response code with the message "ASP.NET detected invalid characters in the URL". Tracing the request shown me that the error was thrown from the "Authentication Module".

我已经搜索了一下,发现每一页都有一个ValidateRequest,并改变其值设置为false解决了这个问题。不幸的是我使用的HttpHandler。有谁知道如何使用HTTP处理程序停止请求验证?

I've searched a bit and found that every page has a ValidateRequest and changing its value to false solves the problem. Unfortunately I'm using Httphandler. Does anyone know how to stop the request validation using http handler?

推荐答案

我遇到了同样的问题(创建一个需要接受与URL中的特殊字符请求的IHttpHandler的)。我必须做两件事情来解决这个问题:

I ran into the same problem (creating an IHttpHandler that needed to receive requests with special characters in the URL). I had to do two things to fix it:

创建为1的值以下DWORD注册条目: HKEY_LOCAL_MACHINE \ SOFTWARE \微软\ ASP.NET \ VerificationCompatibility

在web.config中,设置的requestFiltering元素的allowDoubleEscaping属性为true。

In the web.config, set the allowDoubleEscaping attribute of the requestFiltering element to true.

 
精彩推荐
图片推荐