Server.Transfer Vs. Response.Redirect

前端 未结 16 2542
夕颜
夕颜 2020-11-22 14:38

What is difference between Server.Transfer and Response.Redirect?

  • What are advantages and disadvantages of each?
  • When is one
16条回答
  •  长情又很酷
    2020-11-22 15:15

    Response.Redirect: tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.

    Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.

提交回复
热议问题