Server.Transfer / Response.Redirect(blogs.msdn.com)
submitted by
wisemx(8074) 3 years, 7 months ago
Server.Transfer and Response.Redirect are causing a new page to be processed, but the big difference is how they are doing it.
- Server.Transfer terminates the execution of the current request (Response.End) and begins execution of a new request using the supplied url. No trip back to client is performed.
- Respose.Redirect creates a special header, sends it to the client to ask the server for a different page.
o Response.Redirect(url) == Response.Redirect(url, true). In this case, right after creating the header, the page execution is done – Response.End is called, and this one causes the current thread to be aborted (ThreadAbortException will be thrown).
o Response.Redirect(url, false) doesn’t abort the thread, so it is recommended because it avoids the exceptions. This form is used for example by FormsAuthentication.RedirectFromLoginPage method.
|category: ASP.NET
|Views: 18
tags:
redirect Server.Transfer ASP.NET another
Everyones tags:
Your Tags: