Article ID: 219294
One of the new Active Server Page (ASP) features introduced with Internet Information Services (IIS) version 5.0 is a transfer method for the ASP built-in Server object.
This new method is an alternative to using the Response.Redirect method to transfer to another page, and allows the transfer of the ASP built-in and Error objects to a second page. In addition, the transfer takes place on the server instead of forcing the browser to redirect to a new page.
When the Server.Transfer method is called, execution of the first page is terminated and execution of the second page begins. If the first page has started writing to the response buffer, the second page appends to the buffer instead of replacing it. If buffering is on, then HTTP headers can be modified by the ASP file that it is transferred to. If buffering is off, the HTTP headers are not modifiable by the ASP file that it is transferred to, unless no content has been sent by ASP yet. Additionally, multiple transfers can be called in succession, thereby chaining pages together.
The only data transferred to a second ASP page are the ASP built- in objects and the ASP Error object values from the first request. Any variables declared by the first ASP page are not available in the second ASP page.
When you transfer to a page in another application, the Application and Session objects will contain information from the originating application. Accordingly, the ASP page that it is transferred to is treated as part of the originating application.
ExampleThe following example pages illustrate how the Server.Transfer method may be used. In this example, the starting page contains two forms, one using the HTTP POST method and the other using the HTTP GET method. Both pages use the same second page that detects the HTTP method and transfers to a different third page for each method used. Because the transfer method is being used, the Request Object is still populated and the correct results from the first page are displayed on the respective third page.
To try this example, save all pages to a Web folder with "Script" access enabled and browse "page1.asp."
Article ID: 219294 - Last Review: June 22, 2014 - Revision: 4.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.