Transfer

The transfer method sends all of the information that has been assembled for processing by one .asp file, to a second .asp file.

Syntax

Server.Transfer(path)

Parameters

Path The location of the .asp file to which control should be transferred.

Remarks

When you call Server.Transfer the state information for all the built-in objects will be included in the transfer. This means that any variables or objects that have been assigned a value in session or application scope will be maintained. In addition, all of the current contents for the request collections will be available to the .asp file receiving the transfer.

If the path you specify in the input parameter is for an .asp file in another application, the .asp file will execute as if it were in the application that contains the Server.Transfer command. In other words, all variables and objects that have been given application scope either by other .asp files in the application or by the application's Global.asa file will be available to the called .asp file.

Example

The following example demonstrates transferring from one .asp file to another .asp file, and sending the session identifier to the client.

The output from these scripts will be:

A session ID

I am going to ASP2

The same session ID

ASP1

<HTML><BODY><%  Dim sessvar1  Response.Write Session.SessionID
  Response.Write ("<BR>")
  Response.Write("I am going to ASP2 <BR>")
  Server.Transfer("/Myasps/ASP2.asp")
%>

ASP2

<HTML>
<BODY><% Response.Write Session.SessionID %></BODY></HTML>

Applies To

Server Object

See Also

Execute, Application Object

© 1999 Microsoft Corporation. All rights reserved. Terms of use.