Response.Redirect在HttpModule [英] Response.Redirect in HttpModule
问题描述
我可以重定向到HttpModule中的自定义页面吗?
Can I do a redirect to a custom page in an HttpModule?
我有一个HttpModule A,当任何aspx页面加载时执行一些javascript代码。
我想有一个服务器端代码检查,看看客户端浏览器是否支持cookie。
我可以将该代码放在HttpModule A中吗?如果是,在哪个事件?
或者我需要一个新的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?
此外,是否可以检查HttpModule中的Cookie )?
我看到的所有解决方案都需要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在HttpModule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!