Response.Redirect in HttpModule

Can I redirect to a custom page in an HttpModule?

I have an HttpModule A that executes some javascript code when any aspx page loads. I would like to have server side code validation to see if browser browsers support cookies. Can I post this code in HttpModule A? If so, in which case? Or do I need to have a new HttpHandler for both purposes?

Also, is it possible to check cookies in an HttpModule (without response.redirect)? All the solutions I saw require 2 pages, 1 to set up a cookie and another to check if a cookie was actually created. I hope there should be a way to check cookies in one place.

Thank you in advance

+3
source share
2 answers

You can use the same HttpHandler for both. A cookie check must be sent in the event before calling the page handler, such as the "BeginRequest" event. Then you can use Response.Redirect or Context.RewritePath.

0
source

Source: https://habr.com/ru/post/1716338/


All Articles