Server.Transfer
Server.Transfer() helps the one less round trip. The main advantage of this transfer the first page to second page with better performance. The data can pass through variables, query string and also can retrive from the previous page control value.
Eg: Server.Transfer("Default.aspx");
Response.Redirect()
It is very similar to server.Transfer. The main difference is the posted pervious page values can't be accessable. Here also the data can pass through server variables and query string. It simply redirect the page from one page to another.
Eg: Response.Redirect("Default.aspx")
Note: But the pervious page values can't be accessable by Response.Redirect().
You can force reauthorization by using the Redirect method instead of the Transfer method. The Redirect method performs a client-side redirect in which the browser requests the new resource. Because this redirect is a new request entering the system, it is subjected to all the authentication and authorization logic of both the IIS and ASP.NET security policy.
One more important difference -
PreviousPage.FindControl() is not available after Response.Redirect, but it is available after Server.Transfer
One more -
You can use HttpContext.Current.Items can be used to transfer data in Server.Transfer, but it cannot be used for Response.Redirect. Session, QueryString can be used with Response.Redirec
0 comments:
Post a Comment