HTTP模块的BeginRequest我们应该的Response.Redirect或Server.Transfer的 [英] HTTPModule BeginRequest should us Response.Redirect or Server.Transfer

查看:312
本文介绍了HTTP模块的BeginRequest我们应该的Response.Redirect或Server.Transfer的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用的Response.Redirect在BeginRequest事件的方法来更改目标页面URL重写协作模块。

We have a URLRewriting module that is using a Response.Redirect in the BeginRequest event method to change the destination page.


  • 难道是更好地使用Server.Transfer的或Server.TransferRequest代替Response.Redirect的?

  • 里有其他的解决方案HTTP模块,我会绕过任何其它模块的使用Server.Transfer的,或将在服务器开始,就好像它是一个新的请求,只是节省了往返于浏览器?

  • 将在客户端通知任何分歧,将在服务器中区别对待的要求呢?

下面的问题包括重定向和转移而不是HTTP模块内的差异;

The following questions cover the differences between redirect and transfer but not within an HTTP Module;

编辑: 的HttpContext .RewritePath 也模块中使用这样看来,我们有三种技术来移动从原始路径的初始请求;重定向,转入,分别RewritePath其中;回到浏览器,回到启动HTTP管道,并继续对新的路径处理。

HttpContext.RewritePath is also used in the module so it seems we have three techniques to move the initial Request from the original path; Redirect, Transfer, RewritePath which respectively; go back to browser, back to start of HTTP pipeline and continue processing on new path.

推荐答案

下面是重定向的VS转让VS RewritePath了最好的诠释; <一href=\"http://www.developerfusion.com/article/4643/implementing-http-handlers-in-aspnet/4/\">http://www.developerfusion.com/article/4643/implementing-http-handlers-in-aspnet/4/

Here's the best explanation of Redirect vs Transfer vs RewritePath; http://www.developerfusion.com/article/4643/implementing-http-handlers-in-aspnet/4/

要总结;重定向需要往返到浏览器,传输保证了原Request对象一直不新的要求,但有问题后背上,重写失去原单Request对象,但是是最好的性能。

To summarise; Redirect requires roundtrip to browser, Transfer ensures the original Request object remains not the new request but has problems with Post-backs, Rewrite loses the orginal Request object but is the best for performance.

这篇关于HTTP模块的BeginRequest我们应该的Response.Redirect或Server.Transfer的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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