发布形式,以一个404 +的HttpHandler在IIS7:为什么所有POST数据不翼而飞? [英] Posting forms to a 404 + HttpHandler in IIS7: why has all POST data gone missing?

查看:549
本文介绍了发布形式,以一个404 +的HttpHandler在IIS7:为什么所有POST数据不翼而飞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定,这可能听起来有点混乱和复杂,所以多多包涵。

OK, this might sound a bit confusing and complicated, so bear with me.

我们已经写了一个框架,使我们能够定义友好的URL。如果上网为任何任意的URL,IIS尝试显示404错误(或在某些情况下,403; 14或405)。但是,IIS设置,使任何定向到这些特定的错误被发送到.aspx文件。这使得我们可以实现一个HttpHandler处理该请求,做的东西,它涉及到寻找相关的模板,然后执行任何同它相关联。

We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is sent to an .aspx file. This allows us to implement an HttpHandler to handle the request and do stuff, which involves finding the an associated template and then executing whatever's associated with it.

现在,这个在IIS 5和6,所有的作品在一定程度上IIS7 - 但对于一个陷阱,当你发布形式发生

Now, this all works in IIS 5 and 6 and, to an extent, on IIS7 - but for one catch, which happens when you post a form.

看,当你将一个表单POST到一个不存在的URL,IIS说:啊,但URL不存在,并抛出一个405不允许的方法错误。由于我们告诉IIS重定向这些错误对我们的.aspx页面,因此处理它与我们的HttpHandler的,这通常是没有问题的。但作为IIS7的,所有的POST信息已经丢失被重定向到405后,所以你可以不再做最琐碎的涉及形式的东西。

See, when you post a form to a non-existent URL, IIS says "ah, but that url doesn't exist" and throws a 405 "method not allowed" error. Since we're telling IIS to redirect those errors to our .aspx page and therefore handling it with our HttpHandler, this normally isn't a problem. But as of IIS7, all POST information has gone missing after being redirected to the 405. And so you can no longer do the most trivial of things involving forms.

要解决这个问题,我们已经使用的HttpModule,其中preserves POST数据,但似乎在正确的时间没有一个初始化会话(在需要时)尝试。我们也尝试使用的HttpModule的所有请求,而不仅仅是缺少的请求命中四百○三分之四百○四;四百〇五分之一十四,但是这意味着东西,如图像,CSS,JS等正在由.NET code,这是可怕的处理低效的。

To solve this we've tried using a HttpModule, which preserves POST data but appears to not have an initialized Session at the right time (when it's needed). We also tried using a HttpModule for all requests, not just the missing requests that hit 404/403;14/405, but that means stuff like images, css, js etc are being handled by .NET code, which is terribly inefficient.

这使我的实际问题:有没有人遇到过这一点,没有任何人有任何意见或不知道怎样做才能得到的东西再次合作?到目前为止,已有人使用微软自己的 URL重写模块。这会有助于解决我们的问题呢?

Which brings me to the actual question: has anyone ever encountered this, and does anyone have any advice or know what to do to get things working again? So far someone has suggested using Microsoft's own URL Rewriting module. Would this help solve our problem?

感谢。

推荐答案

微软发布了一个修补程序如下:

Microsoft released a hotfix for this :

http://support.microsoft.com/default.aspx/kb/956578

这篇关于发布形式,以一个404 +的HttpHandler在IIS7:为什么所有POST数据不翼而飞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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