传统的ASP使用的Request.Form综合管线时不工作 [英] Classic ASP Request.Form not working when using integrated pipeline

查看:138
本文介绍了传统的ASP使用的Request.Form综合管线时不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大CORP。网站与混合传统的ASP和asp.net目前一个双赢2003服务器托管,IIS 6。

I have a large corp. web site with mixed classic asp and asp.net currently hosted with a Win 2003 server, IIS 6.

我需要修改所有页面输出一些HTML的修改,无论他们来自世界各地。
ASP的一部分,这是真的老了,严重的结构,因此,我不能对任何一种行为一般包括申请,我们需要的所有更改。最后一些ASP页面输出code从多个OCX / COM对象...
我们已经规划了整个重写/迁移到.NET,但不幸的是这是一个长期的项目,我不能去快速。

I need to modify all the pages output with some html modifications regardless the world they comes from. The asp part it's really old and badly structured, thus I can't act on any kind of "general include" to apply all the changes we need. Lastly some asp pages outputs code from multiple OCX/COM objects... We are already planning a whole rewrite/migration to .net, but unfortunately it's a long term project and I can't go for quickly.

所以我想(和测试)迁移它赢得2008 R2,IIS 7.5,并利用集成的管道模式,我可以修改使用.NET的HttpModule所有输出。
一切正常:我能正确地注入HTML code通过ASP和asp.net页面呈现,但我遇到了问题时,传统的ASP页面将要处理通过邮寄(X-WWW-发送表单数据外形urlen codeD)模块。

So I was thinking (and testing) to migrate it to Win 2008 R2, IIS 7.5 and take advantage of integrated pipeline mode where I can modify all output using a .net httpmodule. Everything works fine: I can correctly "inject" html code to pages rendered via asp and asp.net, but I'm running into problems when classic asp pages are going to process form data sent via post (x-www-form-urlencoded) modules.

看来,传统的ASP它缺少的Request.Form对象在所有使用集成管道模式时,在每次使用时抛出的错误80004005;的Request.QueryString,而不是它的正常工作。

It seems that classic asp it's missing Request.Form object at all when using Integrated pipeline mode, throwing out error '80004005' at every usage; Request.QueryString instead it's working correctly.

我不会切换回经典管道模式,因为我将失去修改由传统的ASP渲染页面的好处。使用ISAPI筛选器在这里它是一场噩梦,我不会去那个方向。

I would not switch back to Classic Pipeline mode as I will loose the benefits of modify the pages rendered by classic ASP. The use of a Isapi filter here it's a nightmare and I won't go into that direction.

有谁知道任何解决办法得到的Request.Form传统的ASP工作时,综合管线模式激活
-要么-
任何方式修改最终渲染页面的输出使用传统的管道时,从传统的ASP来,所以我可以把它发送到浏览器之前,.NET code修改?

Does anyone knows any workaround to get Request.Form working for classic asp when Integrated Pipeline mode is active -or- any way to modify final rendered page output coming from classic asp when using classic pipeline so I can modify it with .net code before sending it to browser?

感谢您的帮助,
Squiffy

Thank you for any help, Squiffy

推荐答案

我想这是因为你的HTTP模块中使用的Request.Form。根据我的实验,除非你的ASP code被处理之前,从模块访问它在ASP的Request.Form工作在集成模式。还有就是使用HttpServerUtility.TransferRequest在建议IIS论坛在这种情况下的。
您可以使用

I think it's because you use Request.Form in the http module. According to my experiments Request.Form works in asp in integrated mode unless you access it from module before the asp code is processed. There is a suggestion to use HttpServerUtility.TransferRequest on IIS forums in this case. You can use

  const string dontTransferKey = "DONT_TRANSFER_MODULE";
    if (HttpContext.Current.Request.Headers[dontTransferKey] != null)
        return;

    ...............all your http module logic. use Request.Form...................

    HttpContext.Current.Request.Headers.Add(dontTransferKey, "true");
    HttpContext.Current.Server.TransferRequest(HttpContext.Current.Request.Url.AbsolutePath, true);

有这种解决方案的几个缺点:如果你使用一个以上的HTTP模块,你需要确保它们是幂等。这可能是非常困难的在第三方模块的情况下。

There are several drawbacks of this solution: if you use more then one http module you need to be sure that they are idempotent. And this could be very difficult in case of third-party modules.

这篇关于传统的ASP使用的Request.Form综合管线时不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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