Home > ASP.NET, c# > mod_rewrite – HttpContext.Current.RewritePath vs HttpContext.Current.Server.Transfer

mod_rewrite – HttpContext.Current.RewritePath vs HttpContext.Current.Server.Transfer

So I’m trying to hide the “real” url of the page being executed in my web app via an HttpModule. I found out today that if you use Server.Transfer, the page you transfer TO has a problem with postbacks that will take us to the “hidden” URL after a submit (button click or whatever). After tinkering with my buttons for about 4 hours trying to get them to submit different, I finally replaced my Server.Transfer with HttpContext.Current.RewritePath where I’m catching the request (OnBeginRequest) in my HttpModule. Once I did that, the browser was brought back to the “hidden” URL after postback. 4 hour painful lesson learned and now shared :)

Categories: ASP.NET, c# Tags:
  1. No comments yet.
  1. No trackbacks yet.