I understand they both don’t change the URL that the client sees. Is there anything in them that makes one of them preferable over the other?
I’m planning to use it in the Application_BeginRequest in Global.asax, but also in regular aspx page.
I understand they both don’t change the URL that the client sees. Is there
Share
I think
Context.RewritePath()is the better option. Reason:Server.Transfer()throws aThreadAbortExceptionevery time. The result of callingResponse.End().For more details read the following MS articles:
More Information:
Server.Transfer()does not send a HTTP 302 redirect command asResponse.Redirect()would do.According to HttpContext.RewritePath on MSDN,
RewritePath()is used in cookieless session state.Also, on a different subject,
Server.Transfer()andServer.Execute()are very different:Server.Execute()returns control to the initial page immediately after where it was called.For Example:
Would output: