What is the difference between calling Response.Redirect from the codebehind of a page, versus calling HttpContext.Current.Response.Redirect from a shared method on another class?
When I call HttpContext.Current.Response.Redirect it is giving me a 404 error sometimes, when calling Page.Respsone.Redirect doesn't.
EDIT:
Oops, my mistake, it was a typo.
There is no difference between the two methods (the getter for Page.Request simply returns a reference to HttpContext.Current.Request - you have to dig a bit in Reflector but it's there) - the HTTP404 you see as a result is the response from the server and is totally dependent on the value passed to the Redirect method.
You'll only get the 404 error if your URL points to a non-existent page. These two methods are the same, it's your code that'll be the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With