Both "Server" and "Response" are objects of ASP.NET and both are used to transfer a user from one page to another page. Logically both methods are used for the same purpose but still there are some technical differences between both which we need to understand. Differences between both are as follows:
Syntactically both are different. Syntax for sending a user to page "example.aspx" for both method is as below,
Response.Redirect involves an extra round-trip to the server whereas Server.Transfer() conserves server resources by avoiding that extra round-trip. Server.Transfer() just changes the focus of the page by directly communicating with server.
Round-trip - Response.Redirect() first sends request for new page to the browser, then browser sends that request to the web-server, and after that your page changes. But Server.Transfer() directly communicate with the server to change the page hence it saves an extra round-trip (to the browser) in the whole process.
If you are using Server.Transfer() then you can directly access the values, controls and properties of the previous page which you can't do with Response.Redirect().
Suppose you have redirected user from Page1.aspx to Page2.aspx using Response.Redirect() then when user is transffered to Page2.aspx then Pag1.aspx has been flushed from the server's memory and hence no information of previous page are accessible, unless the developer explicitly saved the information using some other methods like session, cookie, application, cache etc. But in case of Server.Transfer variables can stay in scope and Page2.aspx can access values, controls, etc. of previous page Page1.aspx as it's still in memory, because Server.Transfer just changes the focus from Page1.aspx to Page2.aspx, so in this case browser doesn't know that any change is happen and which is why with Server.Transfer() we can access values of previous page.
Response.Redirect() changes the URL in the browser's address bar, so they can be bookmarked. Whereas Server.Transfer() retains the original URL in the browser's address bar, it just replaces the contents of the previous page with the new one and hence bookmarking is not works properly.
Server.Transfer() directly communicate with the server for new page request, and hence browser doesn't aware that there is any change happened. Whereas Response.Redirect() first send request (for new page) to browser, then further processing will be performed, so here browser knows that there is some change in the browser window that's why it changes the URL in the address bar.
We can't call it as a problem "No change of address in the browser address bar" it depends on how you see it. This is a good if you see it from security point of view, but it is a problem if you refresh your page or you wanted to bookmark that page. Browsers perform Refresh and Bookmark operations on the URL which is present in the address bar, but as we know Server.Transfer() doesn't changes the URL, so sometimes its a problem with this method.
Response.Redirect() can be used for both .aspx and .html pages, whereas Server.Transfer() can be used only for .aspx pages and is specific to ASP and ASP.NET.
With Response.Redirect() you can redirect the user to the both type of pages .html or .aspx as below,
But Server.Transfer() only work with .asp or .aspx page as show below
Response.Redirect() can be used to redirect to an external websites, whereas we cannot use Server.Transfer() to redirect to an external website. We can use Server.Transfer() to redirect only inside the same website.
Let's say on click of a link I want to redirect user to http://www.yahoo.com/ . With Response.Redirect() you can redirect user to the external site, but in case of Server.Transfer() wouldn't let you perform this operation, because Yahoo.com resides on different server than yours. Server.Transfer() only work with the .asp or .aspx pages present inside your web application.
Now the question arises which to use and when to use? Mostly Server.Transfer() method is recommended to use because it is faster because it saves a round-trip in the process of redirecting from one page to another, but some people says that Server.Transfer() is not recommended to use because operations typically flows through several different pages due to which you will lose the correct URL of the page in the browser address bar, but again all depends on your situation and requirements.
Server.Transfer() also allows more flexibility as you can use HTTPContext.Items to pass variables between pages, use Server.Transfer() when you need to pass context items. Otherwise use Response.Redirect() as it shows correct URL in the address bar.
Refer this link,
http://www.dotnetexpertguide.com/2010/03/aspnet-difference-between.html Raj_Chennai, if this helps please login to Mark As Answer. | Alert Moderator