Server.Transfer and Response.Redirect

Posted by: priyal.singh963 on 21 December 2018, 5:29 pm EST

  • Posted 21 December 2018, 5:29 pm EST

    What is the difference between Server.Transfer and Response.Redirect?
  • Replied 23 December 2018, 3:35 pm EST

    Hi Priyal,
    Please refer to the following blog for detailed information:
    https://www.c-sharpcorner.com/UploadFile/3d39b4/difference-between-response-redirect-and-server-transfer/

    ~Manish
  • Replied 23 December 2018, 7:56 pm EST

    In [url=https://crbtech.in/programmes/dot-net-training-programme]ASP.Net[/url] Technology both "Server" and "Response" are objects of ASP.Net. Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. But there is some remarkable differences between both the objects which are as follow.

    Response.Redirect
    1. Response.Redirect() will send you to a new page, update the address bar and add it to the Browser History. On your browser you can click back.
    2. It redirects the request to some plain HTML pages on our server or to some other web server.
    3. It causes additional roundtrips to the server on each request.
    4. It doesn’t preserve Query String and Form Variables from the original request.
    5. It enables to see the new redirected URL where it is redirected in the browser (and be able to bookmark it if it’s necessary).
    6. Response. Redirect simply sends a message down to the (HTTP 302) browser.

    Server.Transfer
    1. Server.Transfer() does not change the address bar, we cannot hit back.One should use Server.Transfer() when he/she doesn’t want the user to see where he is going. Sometime on a "loading" type page.
    2. It transfers current page request to another .aspx page on the same server.
    3. It preserves server resources and avoids the unnecessary roundtrips to the server.
    4. It preserves Query String and Form Variables (optionally).
    5. It doesn’t show the real URL where it redirects the request in the users Web Browser.
    6. Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.
  • Marked as Answer

    Replied 26 December 2018, 4:20 pm EST

    Hi Rahil,
    Thanks for clarifying the differences here.

    ~Manish
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels