In this blog, I’m explaining the concept of Response.Redirect() and Server.Transfer() method.

Response.Redirect() and Server.Transfer() both methods are user for user page transfer on page to another page. Both methods are same like as but some but some differences. Response.Redirect() sends an HTTP request to the browser, then the browser sends that request to the web server, then the web server delivers a response to the web browser.

Response.Redirect involves a roundtrip to the server whereas Server.Transfer conserves server resources by avoiding the roundtrip. It just changes the focus of the webserver to a different page and transfers the page processing to a different page.

Roundtrip means in case of Response.Redirect it first sends the request for the new page to the browser then browser sends the request for the new page to the webserver then after your page changes But in case of Server.Transfer it directly communicate with the server to change the page hence it saves a roundtrip in the whole process

Response.Redirect() Syntax as like:


Server.Transfer() Syntax as like:


Difference between Response.Redirect() and Server.Treansfer()

·     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.

·    Response.Redirect() can be used to redirect a user to an external website. Server.Transfer() can be used only on sites running on the same server. You cannot use Server.Transfer() to redirect the user to a page running on a different server.

·    When you use Server.Transfer(), then the previous page also exists in server memory while in the Response.Redirect() method, the previous page is removed from server memory and loads a new page in memory.

Step 1

Create a form as given below:

Step 2

Write code in the webForm1.aspx file

using System;
public partial class webForm1 : System.Web.UI.Page
    string MethodName;
    protected void btnResponseRedirect_Click(object sender, EventArgs e)
    protected void btnServerTransfer_Click(object sender, EventArgs e)

Step 3

Run the application click on Redirect From Response button.

Step 4

Click on Redirect From Server button.

  Modified On Sep-18-2014 01:24:25 PM

Leave Comment