Canceling request validation using HttpHandler on IIS 7(在 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 的 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 取消请求验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 IIS 7 上使用 HttpHandler 取消请求验证


- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01