ASP.Net Interview questions: - Explain differences between 'Server. Transfer' and 'response.Redirect'?
- By Shiv Prasad Koirala in ASP.NET
- May 3rd, 2012
- 13832
- 0
Following are the major differences between them:-
‘Response. Redirect' sends message to the browser saying it to move to some different page, while server. Transfer does not send any message to the browser but rather redirects the user directly from the server itself. So in ‘server. Transfer' there is no round trip while ‘response. Redirect' has a round trip and hence puts a load on server.
Using ‘Server. Transfer' you cannot redirect to a different from the server itself. Example if your server is www.yahoo.com you cannot use server. Transfer to move to www.microsoft.com but yes, you can move to www.yahoo.com/travels, i.e. with in websites. Cross server redirect is possible only by using Response. Redirect.
With ‘server. Transfer' you can preserve your information. It has a parameter called as "preserveForm".Therefore, the existing query string etc. will be able in the calling page.
If you are navigating within the same website use "Server. Transfer" or else go for "response.Redirect ()"
See the following video on ASP.NET4.0: -
Click for more ASP.NET interview questions
Regards,
Visit for more Authors' blog on ASP.NET interview questions
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more