Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 1st, 2008, 08:48 PM
Posts: n/a
Default Diff bet Response.Redirect and Server.Transfer

I wanted to know the difference between Response.Redirect and Server.Transfer.

Old October 2nd, 2008, 12:51 AM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

Response.Redirect sends a message to the browser telling it that the page it is looking for has "temporarily moved" and giving it the new URL the page has moved to. [Sometimes, in our code, we fib and say the page has moved when we really aren't doing that, at all.]

When you use Response.Redirect, you can *NOT* send *ANYTHING ELSE* from the server to the browser! ASP and ASP.NET take care of this for you, if Response buffering is turned on (it is, by default), by clearing anything in the Response before doing the redirect.


Server.Transfer is completely invisible to the browser. It has no idea that you have changed what code on the server is being executed.

Further, the Response object is carried across from the first page to the second, so anything you have written out in the first page *IS* sent to the browser, with all the content from the second page (or third or fourth, if you transfer again!) appended to the end.


So you can see there's actually no similarity at all between the two operations.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Server.Transfer vs. Response.Redirect mikener BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 April 10th, 2008 04:18 PM
Server.Transfer and Response.redirect lavanyarl ASP.NET 1.x and 2.0 Application Design 1 November 9th, 2004 03:31 AM
Differenc Between Redirect and Transfer qadeerahmad General .NET 1 August 17th, 2004 02:18 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.