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 取消请求验证
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- WPF 模态进度窗口 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
