Server.Transfer () performance aspect with Response.Redirect ()

Server.Transfer() and Response.Redirect() are still good with many tutorials / details on this topic. However, I recently noticed in an Apress book: Pro Asp.net 4 in C# 2010 that he said that Server.Transfer() is actually faster.

Many tutorials / discussions on this topic are good, but most of them don't seem to shed light on what's faster.

So, in this regard:

So far, I only know that there are no round trips in Server.Transfer() . But what are the different stages of this round in both of these methods that created the performance difference? Also, what other considerations or features speed up Server.Transfer ()?

If there is no other function other than the explanation for the circuit, will it really matter in terms of speed?

+4
source share
1 answer

But what are the different stages of this round in both of these methods that created the performance difference?

  • after Server.Transfer

    • landing page starts execution
  • after the answer. Ed.

    • a (usually) HTTP 302 is issued to the client (network latency)
    • the client receives a response and issues a request to the server (network delay)
    • the server processes the request, looking at its possible modules (authentication, authorization, URL rewriting, etc.)
    • asp.net handles some of its events (begin_request, some authorization processing)
    • you are in step 1 of Server.Transfer, the landing page starts execution

Also, what are other considerations or features that make Server.Transfer () faster

Each step above is itself a feature that makes Server.Transfer faster.

If there is no other function than the explanation, will it really be of great importance in terms of speed?

The difference is huge. Server.Transfer is in memory processing and milliseconds, Response.Redirect is about network latency and seconds.

But the choice between Server.Transfer and Response.Redirect depends not only on the performance depending on your goal: changing the URL in the client navigation panel or saving the request context (form data, headers, ...) for processing, processing a possible update with customer

+2
source

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


All Articles