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
How to make paging concepts in datagrid in ASP.NET?
Explain serialization and deserialization?
What's the difference between viewstate and sessionstate?
Why web api is better than wcf?
What are the steps to follow to host a web application on a web server?
Explain the Order of events in an asp.net page?
In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?
What is meant by server side scripting?
Describe how passport authentication works.
What is postback and autopostback in asp.net?
What do you mean by marshalbyref?
Hi All, Im an MCA holder with 3+ years of experience in asp.net. Now i want to move to some good government job. I have no idea about different categories of exams held & which one can be applicable for my education background. I have done B.A with MCA. Please help me out with your valuable suggestions. I would be very grateful. Thanks Anuj
What symbol specifies the beginning of a query string?
What is application in asp net?
What are uri parameters?