What is difference between response.redirect and
server.transfer ?
Answers were Sorted based on User's Feedback
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 |
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 |
To load your generated dataset with data which method do you invoke?
How to set/get parent page values in child page in asp.net
What is the main difference between grid layout and flow layout?
and can u telme how to explain about our job profile if i have 3years of it experiance in dotnet domain and where to start and where to end , and what shoul i tel and what not(can i mention my education ,and family details,......)i am confusiong a lot. can i ask one with your permision, if u have question that u u went tcs interview as 3+years exp so he/she asked tel me about your profile how can u tel and where to stop. please help me as simple as possible i am facing lot in this..............plese can anyone help me i am awaiting for your reply.
How do I open an ashx file in windows 7?
2. Why did you choose this career?
2 Answers Schwartz Oil, Swatz Oils,
How many classes can a single .NET DLL contain?
How you will handle session when deploying application in more than a server? Describe session handling in a webfarm, how does it work and what are the limits?
How to find last error which occurred in Asp.net ?
What is the request flow used for asp.net mvc framework? : asp.net mvc
Explain swagger components.
What is localhost in asp.net?