在 IIS 7 上使用 HttpHandler 取消请求验证 [英] Canceling request validation using HttpHandler on IIS 7

查看:20
本文介绍了在 IIS 7 上使用 HttpHandler 取消请求验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序必须处理在其 URL 中获取特殊"字符(如 &、+、% 等).当我使用这些字符向应用程序发送请求时(当然我发送它们是转义的),我收到带有消息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. 创建以下值为 1 的 DWORD 注册条目:HKEY_LOCAL_MACHINESOFTWAREMicrosoftASP.NETVerificationCompatibility

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

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

这篇关于在 IIS 7 上使用 HttpHandler 取消请求验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆