METHOD:  Server.Transfer

Implemented in version 3.0

Server.Transfer (Path)

The Transfer method allows you to transfer from inside one ASP page to another ASP page. All of the state information that has been created for the first (calling) ASP page will be transferred to the second (called) ASP page. This transfered information includes all objects and variables that have been given a value in an Application or Session scope, and all items in the Request collections. For example, the second ASP page will have the same SessionID as the first ASP page.

When the second (called) ASP page completes its tasks, you do not return to the first (calling) ASP page.

In contrast, the Execute method allows you to call another ASP page, and when the called page has completed its tasks, you return to the calling ASP page.

There is one mandatory argument.

Path

The Path argument is a string specifying either the absolute or relative path of the ASP page being called. The file name must be included in the path. The entire Path must be enclosed inside a pair of quotes.

In this example, the first ASP page (CallingAsp.asp) has no output.

Code:
----------CallingAsp.asp----------
<%
Application("name") = "Application Maker"
Application("publishdate") = "05/15/01"
Application("author") = "DevGuru"
Set Application("Obj1") = Server.CreateObject("ADODB.Connection")

Server.Transfer("CalledAsp.asp")
%>


----------CalledAsp.asp----------
<%;
Response.Write "Output from CalledAsp.asp"
For Each Item in Application.Contents
    If IsObject( Application.Contents(Item)) Then
      Response.Write Item & " is an object.<BR>"
    Else
      Response.Write Item & "=" & Application.Contents(Item) & "<BR>"
    End If
Next
%>

 
Output:
Output from CalledAsp.asp
name=Application Maker
publishdate=05/15/01
author=DevGuru
OBJ1 is an object.
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information