2025-04-27 07:49:33 -04:00

111 lines
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>Transfer</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H4><A NAME="_transfer"></A><SUP></SUP>Transfer</H4>
<P>The <B>transfer</B> method sends all of the information that has been assembled for processing by one .asp file to a second .asp file.</P>
<H6>Syntax</H6>
<P><B>Server.Transfer</B> <B>(</B><I>path</I><B>)</B></P>
<P>&nbsp;</P>
<H6>Parameters</H6>
<DL>
<DT><I>Path</I></DT>
<DD>The location of the .asp file to which control should be transferred.</DD>
</DL>
<H6>Remarks</H6>
<P>When you call <B>Server.Transfer</B>, 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.</P>
<P>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 <B>Server.Transfer</B> 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. However, the path parameter must not contain an query string or ASP returns an error.</P>
<P><B>Server.Transfer</B> acts as an efficient replacement for <B>Response.Redirect</B>. <B>Response.Redirect</B> tells the browser to request a different page. Since a redirect forces a new page request, the browser has to make two round trips to the Web server, and the Web server has to handle an extra request. IIS 5.0 introduced a new function, <B>Server.Transfer</B>, which transfers execution to a different ASP page <I>on the server</I>. This avoids the extra round trip, resulting in better overall system performance, as well as a better user experience.</P>
<H6>Example</H6>
<P>The following example demonstrates transferring from one .asp file to another, as well as sending the session identifier to the client.</P>
<P>The output from these scripts will be:</P>
<P>A session ID</P>
<P>I am going to ASP2</P>
<P>The same session ID</P>
<P><B>ASP1</B></P>
<PRE><CODE>&lt;HTML&gt;&lt;BODY&gt;&lt;% Dim sessvar1 Response.Write Session.SessionID
Response.Write ("&lt;BR&gt;")
Response.Write("I am going to ASP2 &lt;BR&gt;")
Server.Transfer("/Myasps/ASP2.asp")
%&gt;
</CODE></PRE>
<P><B>ASP2</B></P>
<P><CODE>&lt;HTML&gt;</CODE></P>
<P><CODE>&lt;BODY&gt;&lt;% Response.Write Session.SessionID %&gt;&lt;/BODY&gt;&lt;/HTML&gt;</CODE></P>
<H6>Applies To</H6>
<P><A HREF="/iishelp/iis/htm/asp/vbob7838.htm"><B>Server</B> Object</A></P>
<H6>See Also</H6>
<P><A HREF="/iishelp/iis/htm/asp/vbob9pid.htm"><B>Execute</B></A>, <A HREF="/iishelp/iis/htm/asp/glob63vp.htm">Global.asa Reference</A>, <A HREF="/iishelp/iis/htm/asp/vbob8zw4.htm"><B>Application</B> <B>Object</B></A></P>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>