Why can't we use Server.Transfer () to redirect to another server

I know that Server.Transfer () should be used to redirect to another ".aspx" page on the same server. But what is the reason why I should not use this method to redirect to an aspx page on another server or html page? Your answers have indeed been confirmed.

+3
source share
5 answers

Server.Transfer can occur for only one HttpContext. Each virtual directory or application has its own HttpContext object, and they do not know that they coexist! therefore you cannot do this.

+3
source

-, Server.Transfer . , , "" - . , HTTP-, , , - .

: "" , , Server.Transfer . Response.Redirect .

-, Server.Transfer URL- . , .

: Server.Transfer vs. Response.Redirect

, : Response.Redirect . Server.Transfer , URL- , , .

  • Response.Redirect , , .
  • URL-, . , , / , , .
  • Server.Transfer .
  • , , ViewState ( EnableViewStateMac true), . , :
+9

Server.Transfer() -.

"" ( -/) , Request . , -.

, -, . , , , Response.Redirect.

+5

Sessions are not distributed between servers, so this will be a big problem.

0
source

Source: https://habr.com/ru/post/1716878/


All Articles