Illustrate
the importance of Server.Transfer and Response.Redirect in .NET?
In your code
when you are trying to redirect from the current page to a different page,
then you will be using either Server.Transfer or Response.Redirect.
Purpose of each of them along with their differences is tabulated below:
Server.Transfer
Response.Redirect
When
you want to move from the current page to a different page in the
same website then you can use Server.Transfer.
When
you want to redirect from the current page to a page belonging to
some other website then you can use Response.Redirect.
When
you use Server.Transfer, the user will be redirected from the server
directly to the other page.
When
you use Response.Redirect, a message will be sent to the browser requesting
it to move to the different page.
This
is advantageous because the user is directly transferred to the page.
This
has a considerable load on the server since it has a round trip due
to sending message to browser and then browser loading the new page.
You
cannot redirect the user to a different server using Server.Transfer.
Response.Redirect
gives you the facility to redirect to a different server.
If you
use Server.Transfer, you can retain the existing data that you have
entered in the current page using preserveForm parameter.
You
cannot retain data while using Response.Redirect.
FREE
Subscription
Subscribe
to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.
Note
: We never rent, trade, or sell my email lists to
anyone.
We assure that your privacy is respected
and protected.