What is difference between response.redirect and
server.transfer ?

Answers were Sorted based on User's Feedback



What is difference between response.redirect and server.transfer ? ..

Answer / 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

What is difference between response.redirect and server.transfer ? ..

Answer / minhajul islam

1. Redirect can redirect to outside page while Transfer can
use page only in the same project.
Example : Redirect("www.yahoo.com") while transfer can
only inside current project page.

2. Redirect does not transfer content of the page while
Transfer transfers controls of current to transferred page.
For example if we use Multi-Page form and need to access
components of each page then we can use Transfer but must
use CrossPagePostBack.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

What type of code (server or client) is found in a Code- Behind class?

2 Answers  


Describe session handling in a webfarm?

0 Answers  


if u r projet consist of 4 people means how can u manage the file

10 Answers   Mind Tree,


What is the basic purpose of the required field validator? How can you use a required field validator to check that the user changes the initial value of a text box? a listbox?

0 Answers  


Explain http handlers? Where we can use the http handlers?

0 Answers   Accenture,






Hi, We have a user control that have button Now we use this user control on different aspx pages. We want when we click on the user control button then button behave differently on different page (Dynamacilly).

2 Answers   HCL,


Where is asp.net view state stored?

0 Answers  


What is difference between user control and custom control?

1 Answers   TVS,


What is the difference between user control and custom control?

0 Answers  


Can you dynamically assign a Master Page?

0 Answers   MCN Solutions,


What are the properties of the eventargs argument when capturing keyboard events?

0 Answers  


What does setting a control's EnableViewState property to false accomplish?

1 Answers  


Categories