Monday, May 11, 2009

What is the difference between Server.Transfer and Response.Redirect?

Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.
page must be in same server and an ,aspx file
This method avoids un-necessary round trips
Response.Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.
1: we can pass query string vales
2: we can connect to non .aspx page(ex. .html)
3. we can connect to resource to any server.

No comments:

Bookmark and Share