当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Transfer 方法

ASP
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator
ASP Quick Ref
ASP 摘要
ASP 实例

ASP Transfer 方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 374 ::
收藏到网摘: n/a

The Transfer method sends (transfers) all the state information (all application/session variables and all items in the request collections) created in one ASP file to a second ASP file.
Transfer方法的作用是将所有的陈述性信息(包括所有的application或session变量以及request集合中的所有项目)从其中一个ASP文件发送到另一个ASP文件。

When the second ASP page completes its tasks, it will NOT return to the first ASP page (like the Execute method).
当第二个ASP页面完成这项任务后,他将不再返回第一个ASP页面(这与Execute方法不大相同)。

Note: The Transfer method is an efficient alternate for the Response.Redirect. A redirect forces the Web server to handle an extra request while the Server.Transfer method transfers execution to a different ASP page on the server, and avoids the extra round trip.
注意:Transfer方法有效的替代了Response.Redirect方法。,Redirect(重定向)是强制网络服务器执行这个特殊的请求,而Server.Transfer方法可以将程序转移到服务器上另外一个不同的ASP页面上执行,从而可以避免其他的特殊访问。

Syntax
语法

Server.Transfer(path) 

Parameter
参数
Description
描述
path Required. The location of the ASP file to which control should be transferred
必要参数。被转移执行的ASP文件的路径。

Example
举例

File1.asp:
<%
response.write("Line 1 in File 1<br />")
Server.Transfer("file2.asp")
response.write("Line 2 in File 1<br />")
%>

File2.asp:

<%
response.write("Line 1 in File 2<br />")
response.write("Line 2 in File 2<br />")
%>

Output:

Line 1 in File 1
Line 1 in File 2
Line 2 in File 2

Also look at the Server.Execute method to see the difference between the Server.Transfer and Server.Execute methods.
通过使用Server.Execute方法,我们同样可以发现Server.Transfer和Server.Execute之间存在不同。

评论 (0) All

登陆 | 还没注册?