Server.Transfer is NOT more useful in performance. The better performance is depent from what actuall run in the page and where you call the transfer or the redirect, but the diferent are so small that you need to focus what actuall transfer
vs redirect
do.
Transfer
adds a lot of problems that
add to your navigation from page to
page, eg user see the same page name, but the content is diferent.
Transfer
also can not handle
post back asp.net functions.
- When you use the
transfer
you always need to know on each post back what page you show next because you always load the same code page.
- If you use a lot the
Transfer
, then server for every page need to load and run 2 different page code for the same result.
Redirect
from the other hand is a method to navigate and show results to the processing of user input. Its clean, code on the second page work with out problems, postback and all that work the same.
I suggest to anyone to rare use the Server.Transfer
.
Here is an example that Transfer make thinks complicate and slower. If you have a work to do, and then show result, and lets say that this work makes some seconds, if you make Transfer, on every post back, or reload the work must be run again !.
protected void Page_Load(object sender, EventArgs e)
{
// function works
Thread.Sleep(10000);
Server.Transfer("Page2.aspx");
}
Second Case with redirect, the work will be done one time and not called again, user moves to the result page.
protected void Page_Load(object sender, EventArgs e)
{
// function works
Thread.Sleep(10000);
Response.Redirect("Page2.aspx");
}
I think, that there is no need for too many talks, if you practice them a little you can see many thinks and different in real pages.