在Response.Redirect的HTTP模块 [英] Response.Redirect in HttpModule

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

问题描述

我可以做一个重定向到一个自定义页面的HTTP模块?

Can I do a redirect to a custom page in an HttpModule?

我有一个HttpModule一个里面装的任何aspx页面时执行一些JavaScript code。
我想有一个服务器端code检,看是否客户端浏览器支持cookie。
我可以放置在一个的HttpModule是code?如果是这样,在此情况?
或做我需要有两个目的,一个新的HttpHandler?

I have an HttpModule A which executes some javascript code when any aspx page is loaded. I would like to have a server side code check to see if the clients browsers supports cookies. Can I place that code in the HttpModule A? If so, in which event? Or do I need to have a new HttpHandler for both purposes?

此外,是否有可能检查cookies在一个HttpModule(没有Response.Redirect的)?
所有的解决方案我已经看到需要2页,1设置cookie,另一个是如果cookie实际上已创造了检查。我希望应该有办法在一个地方检查饼干。

Also, is it possible to check for cookies in an HttpModule(without a response.redirect)? All solutions I have seen need 2 pages, 1 for setting the cookie and the other for checking if the cookie has actually been created. I am hoping there should be a way to check for cookies at one place.

在此先感谢

推荐答案

检查了这一点..
http://www.15seconds.com/issue/030522.htm

键为...
Context.RewritePath()

The key being... Context.RewritePath()

MDSN
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.rewritepath.aspx

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

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