What is difference between response.redirect and
server.transfer ?
Answer Posted / skmdali786
This is one of the favorite questions in ASP.NET Interviews.
Every interviewer would like to know from the .NET candidate
two things, how they differ technically and which scenarios
should we use them.
Technical difference :- In Response.Redirect the following
steps happen :-
1 - Client browser sends a signal to the server that he
wants to go to xyz.aspx.
2 - Server responds back to the browser about the location
of xyz.aspx and tells the client to go to that location.
3- Client gets the response and redirects to xyz.aspx.
In server.transfer the the following step happens :-
1 - Client browser sends a signal to the server that he
wants to go to xyz.aspx.
2 - Server redirects to xyz.aspx and send the output to the
client.
In other words in response.redirect there is a round trip
while in server.transfer there are no round trips.
The next question what interviewer will ask is so does that
mean we should always use server.trasfer and
response.redirect is never needed.
Both of the are useful under different scenarios.
Response.redirect is good when we want to go cross domains ,
in other words you want to redirect from www.questpond.com
to www.microsoft.com. Server.trasfer do not work when you go
cross domains.
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?
What is the difference between adding reference in solution explorer and adding references by using ?
What is a user session?
Is redux flux?
Where can I get the details on migration of existing projects using various technologies to asp.net?
What is __ requestverificationtoken?
How we implement web farm and web garden concept in asp.net?
What is asp.net? How is it different from asp?
What are ASHX files?
What are the new login controls in asp.net 2.0?
Can the dictionary object be created in client?s scope ?
Explain how caching in asp.net 2.0 is different from caching in asp.net 1.1?
What are sql joins?
How many types of cookies are available in asp?
What is caching in asp.net?