Please enable Javascript to correctly display the contents on Dot Net Tricks!

Difference between Response.Redirect and Server.Transfer

  Author : Shailendra Chauhan
Posted On : 28 Dec 2012
Total Views : 126,544   
Updated On : 29 Dec 2012
 

In ASP.Net Technology both "Server" and "Response" are objects of ASP.Net. Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. But there is some remarkable differences between both the objects which are as follow.

Response.Redirect

  1. Response.Redirect() will send you to a new page, update the address bar and add it to the Browser History. On your browser you can click back.

  2. It redirects the request to some plain HTML pages on our server or to some other web server.

  3. It causes additional roundtrips to the server on each request.

  4. It doesn’t preserve Query String and Form Variables from the original request.

  5. It enables to see the new redirected URL where it is redirected in the browser (and be able to bookmark it if it’s necessary).

  6. Response. Redirect simply sends a message down to the (HTTP 302) browser.

Server.Transfer

  1. Server.Transfer() does not change the address bar, we cannot hit back.One should use Server.Transfer() when he/she doesn’t want the user to see where he is going. Sometime on a "loading" type page.

  2. It transfers current page request to another .aspx page on the same server.

  3. It preserves server resources and avoids the unnecessary roundtrips to the server.

  4. It preserves Query String and Form Variables (optionally).

  5. It doesn’t show the real URL where it redirects the request in the users Web Browser.

  6. Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.

What do you think?

In this article I have tried to explain the difference between Response.Redirect and Server.Transfer also I explain some scenario when and where we should use each one. i hope the article will be helpful for you. Comments and criticize will be welcome.



Free Interview Books
 
COMMENTS (0)
5 AUG
ASP.NET MVC with Angular4 Development (Online)

10:30 Am to 12:30 PM IST (+ 5:30 GMT)

Know More
3 AUG
ASP.NET Core with Angular4 Development (Online)

07:00 AM - 9:00 AM IST(+5:30 GMT)

Know More
29 JUL
Angular2 and Angular4 Development (Online)

08:00 AM - 10:00 AM IST(+5.30 GMT)

Know More
29 JUL
ASP.NET MVC with Angular4 Development (Classroom)

09:30 AM - 11:00 AM IST (+5:30GMT)

Know More
29 JUL
Xamarin Forms : Build Cross-platform Apps (Classroom)

09:00 AM - 11:00 AM IST(+5:30 GMT)

Know More
26 JUL
ASP.NET MVC with Angular4 Development (Online)

07:00 AM - 09:00 AM IST(+5.30 GMT)

Know More
26 JUL
ASP.NET MVC with Angular4 Development (Online)

07:00 AM - 09:00 AM IST(+5.30 GMT)

22 JUL
MEAN Stack 2 Development (Classroom)

04:00 PM - 05:30 PM IST(+5:30GMT)

20 JUL
Hadoop Development cum Administration (Online)

07:00 AM - 09:00 AM IST(+5:30 GMT)

17 JUL
NodeJS with Angular4 Development (Online)

08:00 PM - 09:30 PM IST(+5.30 GMT)

15 JUL
ASP.NET MVC with Angular4 Development (Online)

03:30 PM - 05:30 PM IST(+5.30 GMT)

1 JUL
ASP.NET MVC with Angular4 Development (Classroom)

08:00 AM - 09:30 AM IST

1 JUL
MEAN Stack 2 Development (Classroom)

11:00 AM - 12:30 PM IST(+5:30 GMT)

30 JUN
Xamarin Forms : Build Cross-platform Apps (Online)

09:30 PM - 11:00PM IST(+5:30GMT)

6 JUN
ASP.NET MVC with Angular4 Development (Online)

09:00 PM-11:00 PM IST(+5.30 GMT)

20 MAY
NodeJS with Angular4 Development (Classroom)

05:00 PM - 07:00 PM

2 MAY
ASP.NET Core Development (Online)

07:00 AM - 09:00 AM IST(+5.30 GMT)

BROWSE BY CATEGORY
 
 
LIKE US ON FACEBOOK
 
+