在 IIS 7 上使用 HttpHandler 取消请求验证

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)