Server.Transfer VS Response.Redirect
Server.Transfer is often a
better choice than Response.Redirect.Example: Let's say
you're on A.aspx and you want to send the user to B.aspx.Response.Redirect
flow
A.aspx calls Response.Redirect("B.aspx",false); which sends a 302 redirect
header down to the client browser, telling it that the asset it has requested
(A.aspx) has moved to B.aspx, and the web application terminates. The client
browser then sends a request to the webserver for B.aspx. IIS tells asp_wp.exe
to process the request. asp_wp.exe (after checking authentication and doing all
the other setup stuff it needs to do when a new request comes in) instantiates
the appropriate class for B.aspx, processes the request, sends the result to the
browser, and shuts down.Server.Transfer
flow
A.aspx calls Server.Transfer("B.aspx");. ASP.NET
instantiates the appropriate class for B.aspx, processes the request, sends the
result to the browser, and shuts down.Note that Server.Transfer
cuts the load on the client and the server.
Server.Transfer is easier to
code for, too, since you maintain your state. Information can be passed through
the HTTP Context object between the pages, eliminating the need to pass
information in the querystring or reload it from the database.More info http://dotnetjunkies.com/WebLog/familjones/archive/2004/04/08/11020.aspx and http://www.eggheadcafe.com/articles/20030531.asp.
Regards,
Mitesh Mehta
Microsoft Certified Professional
Direct Information Pvt. Ltd.,
Monday, July 26, 2004
Server.Transfer VS Response.Redirect
Subscribe to:
Post Comments (Atom)
1 comment:
because the "transfer" process can work on only those sites running on the server, you can't use Server.Transfer to send the user to an external site. Only Response.Redirect can do that
Post a Comment