You must Sign In to post a response.
  • Category: .NET

    Difference between Response.Redirect and Server.Transfer


    Please explain the difference between Rresponse.Redirect and Server.Transfer with example.
  • #593143

    1>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 uyser directly from the server itself.So in Server.transfer their is no round trip while Response.redirect has a round trip hence puts a load on the server.

    2>Using Sever.transfer you cannot redirect to a different server itself while using Response.redirect you can redirect to a different server also.

    3>With Server.transfer you can preserve your information.It has a parameter called as "preserve form",so the existing query string etc will be available in the calling page.This is not possible in Response.redirect.

    Thanks & Regards


  • #593148

    1) Response.redirect

    Tranfer control in various different website addres
    Its round trip control
    it support .html and .aspx pages

    2) Server.transfer
    Transfer control only in the same website pages
    Not a round trip control
    Its support .aspx only

    Your Hard work never fails

  • #593194

    Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.

    Response.Dedirect() :client know the physical loation (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.

    As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.







  • #593195

    In addition to whatever is said above, one of the key that we need to understand is the the Response.Redirect send Http code 302 as response to the browser, than the browser redirects the user to the target url.


  • #593223
    1) Server.Transfer can be used only to transfer within the pages of the same web applications, but we can use Response.Redirect to move to any page available over the Internet.
    2) 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.
    3) With Server.Transfer you can preserve your information using preserveForm property. Response.Redirect lose access to all of the properties in the Request object.
    4) Response.Redirect requires a round trip. Where as, Server.Transfer does not requires a round trip.

    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • #593272
    Server.Transfer can be used to tranfer pages that are of same application whereas Response.Redirect can be used to transfer pages within application or outside that application.

    Server.Transfer doesnot requires any round trip to sever

    Microsoft Certified Technology Specialist
    MY Blog..

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.