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