Saturday, September 29, 2007

Server.Transfer , Server.Execute , Response.Redirect Methods

Server.Transfer Vs Server.Execute

Server.Transfer Methods sends all the state information from one page to another.
When the second Page completes its task it doesn’t come back to the first page.

Server.Execute Method sends all the state information from one page to other ,similar to Server.Transfer .Here when the second page completes its task,It returns to the first page.

Server.Execute executes the page and return the results..


Server.Transfer is almost similar to the Response.Redirect but there exists some difference.

Lets look on it.

Server.Transfer Vs Response.Redirect.



Well, Response.Redirect and Server.Transfer are used to transfer user form one page to another. So,whats the difference between them..

Response.Redirect simply sends a message down to the browser, telling it to move to another page. Response.Redirect ("WebForm2.aspx”)

Server.Transfer is similar in that it sends the user to another page with a statement such as

Server.Transfer ("WebForm2.aspx")


Server.Transfer method conserves server Resources. It will change the focus on the server and sends the other requests instead of saying it to redirect .SO,we will get less HTTP requests compare to Response.Redirect which therefore reduces the pressure on the web server.

Server.Transfer can only works on the applications that resides on the server. It cannot transfer to external sites as Response.Redirect does.

Server.Transfer has a parameter called PreserveForm. When it is set to true,it preserves the form variables and query strings and will be available to other page you transferred to.

Server.Transfer ("WebForm2.aspx",true)

So all the variables in webform1 are available to webform2.

No comments:

Post a Comment