Response.redirect and server.transfer (
.NET Interview questions)
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 http://www.questpond.com/ to http://www.microsoft.com/. Server.trasfer do not work when you go cross domains.
22 top important .NET interview questions
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 http://www.questpond.com/ to http://www.microsoft.com/. Server.trasfer do not work when you go cross domains.
22 top important .NET interview questions
No comments:
Post a Comment