Server.Execute and Server.Transfer
Server.Execute Method
- Execute method allows to consider an external page as a subroutine
- When the execution flow reaches the Server.Execute call, control is passed to the specified page
- Execution of the current page is suspended, and the external page is spawned
- Execute method is a more useful alternative to using server-side includes
- Execute makes control to return to the calling page once external page has been executed
Server.Transfer Method
- Calling Transfer method causes termination of current page processing and executes the specified page
- The control never returns to the page that called the Transfer, which is not the case with Server.Execute, where control returns to the calling page
- Hence, any code specified after Server.Transfer call, will not be executed
- It is efficient for two reasons, first no roundtrip to the client is requested, unlike Response.Redirect
- Secondly, the same HttpApplication that was serving the caller request is reused
No comments:
Post a Comment