Response.Redirect in HttpModule

前端 未结 2 1374
夕颜
夕颜 2021-01-21 08:19

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

I have an HttpModule A which executes some javascript code when any aspx page is loaded. I would like to have a se

相关标签:
2条回答
  • 2021-01-21 08:49

    You can use the same HttpHandler for both. The cookie check just needs to go in an event before the page handler gets called, such as the "BeginRequest" event. Then you can use the Response.Redirect or Context.RewritePath.

    0 讨论(0)
  • 2021-01-21 08:50

    Check this out.. http://www.15seconds.com/issue/030522.htm

    The key being... Context.RewritePath()

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

    0 讨论(0)
提交回复
热议问题