Server.Transfer Vs Response.Redirect


Response.Redirect

(1) While executing the Response.Redirect in your code-behind cs file, the server basically sends an HTTP header back to the client browser with an HTTP status code stating that a new resource/page is requested and that resource/page can be found at some newLocation specifid in path.

Response.Redirect("somewhere/newlocation.aspx")

See the snippet of an example HTTP header below.
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Location: somewhere/newlocation.aspx

This tells the browser that the requested page can be found at a new location, namely somewhere/newlocation.aspx. The browser then initiates another request  to somewhere/newlocation.aspx loading its contents in the browser. This results in two requests by the browser.

(2) URL of browser changes as the target URL specified.

(3) Method can redirect to a different server also.

Response.Redirect("http://newserver/index.aspx") // correct

Server.Transfer

(1) Redirection to another URL is performed on server side. Transfer happens on server side and hence consume more resources on server side. Server Handles transfer in only in one request.

(2) Method cannot redirect to a page on a different server.

Server.Transfer("http://newserver/index.aspx")
// incorrect

(3) Maintains the original URL in the browser. So sometimes if user refresh page it makes confusion or error.

(4) This has a second parameter - bool preserveForm.
If this is set to True, the existing query string and any form collections will still be available to the transfering target page.

Server.Transfer("somewhere/newLocation",true);

For Example:
If Source.aspx has a TextBox control called txtUserName and you transferred to Target.aspx with the preserveForm parameter set to True, you will be able to retrieve the value of the original page's TextBox control
by using -

Request.Form("txtUserName").

----------------------------------------------------------
Thank You...
Next Recommended Reading Set Vs Select statement in SQL Server