Tuesday, September 07, 2004

Server.Transfer Vs. Response.Redirect

1.Server.Transfer. Where possible, use the Server.Transfer method
instead of the Response.Redirect method. Response.Redirect sends a response header to the client that causes the client to send a new request to the redirected server by using the new URL. Server.Transfer avoids this level of indirection by simply making a server-side call.

2. You cannot always just replace Response.Redirect calls with
Server.Transfer calls because Server.Transfer uses a new handler during the handler phase of request processing. If you need authentication and authorization checks during redirection, use Response.Redirect instead of Server.Transfer because the two mechanisms are not equivalent. When you use Response.Redirect, ensure you use the overloaded method that accepts a Boolean second parameter, and pass a value of false to ensure an internal
exception is not raised.

3. Also note that you can only use Server.Transfer to transfer control to pages in the same application. To transfer to pages in other applications,you must use Response.Redirect.

0 Comments:

Post a Comment

<< Home