ASP 3.0 - 使用Server.Execute问题:患" ASP失忆" [英] ASP 3.0 - Server.Execute Problems: Suffering from "ASP Amnesia"

查看:107
本文介绍了ASP 3.0 - 使用Server.Execute问题:患" ASP失忆"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建了两个ASP 3.0文件:
-Main.asp
-Colors.asp

Created Two ASP 3.0 Files: -Main.asp -Colors.asp

<%

Blah Blah Blah...

If sColor = true then
Server.Execute "Colors.asp"
End If
'If sColor is true, Pops over to Colors.asp
'Then pops right back over to here again

'Once back here again, it has no idea what
'sRed or sBlue was at all...it's as if has
'been "blank slated"...sRed? Who the heck is sRed?

If sRed then
Response.Write "Color is Red"
End If
'Does not work...skips right over...
'Who is sRed? What is sRed?
'Oh well, keep on truckin'

%>


Col​​ors.asp

<%
Dim sRed
sRed = instr(sString, "Red") >0

Dim sBlue
sBlue = instr(sString, "Blue") >0

Dim sGreen
sGreen = instr(sString, "Green") >0

%>


如果一个人要进入Colors.asp文件
以上并修改/添加它如下:

%>


If one were to go into the Colors.asp file above and modify/append it to read as follows:

<%
Dim sRed
sRed = instr(sString, "Red") >0

Dim sBlue
sBlue = instr(sString, "Blue") >0

Dim sGreen
sGreen = instr(sString, "Green") >0

If sRed then
Response.Write "Color is Red"
End If

%>

人们会收到一个屏幕,颜色为红色
当sColor是真实的在上和Main.asp sSt​​ring
载红。所以,我知道她是越来越那边,
也返回回过来Main.asp ......但不知何故
她没有关于这些变量的线索:SRED,sBlue,
那是在她Colors.asp.Once超过变暗或sGreen
得到的备份到Main.asp她的无能。

One would receive a screen with "Color is Red" when sColor was true over at Main.asp and sString contained "Red." So I know she's getting over there, and also returning back over to Main.asp...but somehow she has no clue about those variables: sRed, sBlue, or sGreen that were dimmed over at Colors.asp.Once she get's back over to Main.asp she's clueless.

怎么办?为什么她有ASP失忆一次她得到
回到Main.asp刚刚已经超过在Colors.asp后?

What gives? Why does she have ASP Amnesia once she gets back to Main.asp after having just been over at Colors.asp?

顺便说一句,我曾经有过一个女朋友行事方式相同。
那么是什么样的ASP偷鸡摸狗的超过布莱恩'在Colors.asp?

BTW, I used to have a girlfriend that acted the same way. So what kinda ASP hanky panky's goin' on over at Colors.asp?

请帮帮忙!

ASP撒尿凌晨

推荐答案

该页面执行在调用页面没有进入局部变量,反之同样没有调用页面访问局部变量在执行的页面。无论你声明与否没有区别两个脚本不单单让同一个上下文中执行相同的范围内。

The executed page has no access to local variables in the calling page and conversely neither does the calling page have access to local variables in the executed page. Whether you declare them or not makes no difference the two scripts are not executing in the same context let alone the same scope.

调用使用Server.Execute()有效地导致在隔离将要执行的执行页及其输出掺入调用页的在该点的输出它被称为:

Calling Server.Execute() effectively causes the executed page to be executed in isolation and its output incorporated into the output of the calling page at the point it is called:

在IIS处理.asp文件
  在输入参数指定
  使用Server.Execute,响应
  返回到调用ASP脚本。

After IIS processes the .asp file specified in the input parameter to Server.Execute, the response is returned to the calling ASP script.

下面的集合和
  属性可向
  执行ASP页:

The following collections and properties are available to the executed ASP page:

* Application variables, even if they are set in the calling page.
* Session properties, even if they are set in the calling page.
* Server variables and properties, even if they are set in the calling page.
* Request collections and properties, even if they are set in the calling page. This includes Form and QueryString data passed to the calling page.
* Response collections and properties. The executed .asp file may modify HTTP headers. However, as with any .asp file, if the executed .asp file attempts to modify HTTP headers after it sends a response to the client, it generates an error.

如果一个文件被包括在调用
  通过使用#include页时,执行
  的.asp不会使用它。例如,您
  可以具有在一个文件中的子程序
  包含在您的调用页面,但
  所执行的.asp将无法识别
  子程序名。您必须包括
  在每个文件中执行的.asp该
  需要子程序

If a file is included in the calling page by using #include, the executed .asp will not use it. For example, you may have a subroutine in a file that is included in your calling page, but the executed .asp will not recognize the subroutine name. You must include the file in each executed .asp that requires the subroutine.

如果你想要做的脚本变量之间传递你好得多使用include指令。如果你必须做的变量传递,那么你将不得不陪审团钻机的东西用应用会话对象,我不会提醒,

If you want to do variable passing between scripts you are much better off using include directives. If you must do variable passing then you will have to jury rig something using the Application or Session object and I would not advise that.

这篇关于ASP 3.0 - 使用Server.Execute问题:患&QUOT; ASP失忆&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆