dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Difference between Resonse.Redirect and Server.Transfer.

  1. #1
    Join Date
    Dec 2018
    Posts
    15

    Difference between Resonse.Redirect and Server.Transfer.

    In ASP.Net 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.

  2. #2
    Join Date
    Jan 2019
    Location
    Slough
    Posts
    20

    Re: Difference between Resonse.Redirect and Server.Transfer.

    Resonse.Redirect and Server.Transfer. both methods are used to transfer a user from one web page to another web page. Both methods are use for the same purpose but still there are some differences.
    The Response.Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,176

    Re: Difference between Resonse.Redirect and Server.Transfer.

    Quote Originally Posted by John Aeliya View Post
    Resonse.Redirect and Server.Transfer. both methods are used to transfer a user from one web page to another web page. Both methods are use for the same purpose but still there are some differences.
    The Response.Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.
    What does 'terminate' mean in your answer? I mean they both leave the first page, but I don't see what you mean by termination the page in the transfer case.

  4. #4
    Join Date
    May 2019
    Location
    601 & 612, The Times square Arcade, Near Baghban party plot, Thaltej - Shilaj Rd, Thaltej, Ahmedabad, Gujarat 380059, India
    Posts
    7

    Post Re: Difference between Resonse.Redirect and Server.Transfer.

    Both Response.Redirect and Server.Transfer methods are used to transfer a user from one web page to another web page. Both methods are used for the same purpose but still there are some differences as follows.

    The Response.Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

    Both Response.Redirect and Server.Transfer has the same syntax like:

    Response.Redirect("UserDetail.aspx");
    Server.Transfer("UserDetail.aspx");

    Server.Tarnsfer sends a request directly to the web server and the web server delivers the response to the browser.
    Response.Redirect can be used for both .aspx and HTML pages whereas Server.Transfer can be used only for .aspx pages and is specific to ASP and ASP.NET.

  5. #5
    Join Date
    Oct 2019
    Location
    Ahmedabad
    Posts
    5

    Re: Difference between Resonse.Redirect and Server.Transfer.

    Resonse.Redirect and Server.Transfer both are used to redirect user from one page to another. The main difference between them is about redirection.In Resonse.Redirect redirection is done by the browser and in Server.Transfer redirection is done by the server.

    (1)Redirection in Resonse.Redirect is done between pages on different server while in Server.Transfer redirection is done between pages of the same server.
    (2)Response.Redirect() sends a redirection header to the client, and the client itself requests the new page while Server.Transfer() stops rendering the current page and starts rendering another one.

    For more differences refer this link : https://www.codeproject.com/Articles...ect-Simplified

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)