如何从server.execute调用返回值 [英] how to return value from server.execute call

查看:76
本文介绍了如何从server.execute调用返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试替换目前我使用#Include指令合并

的大量代码。该程序很少需要流过那个

代码,所以我认为如果我使用Server.Execute会更好。


我发现我可以传递数据通过创建HTML< input>

来调用asp文件,并在我到达后擦除它。


但是,我还需要读回一个变量,被调用文件必须设置为
。我无法想象如何做到这一点。我的备份位置是(1)我可以使用#Include技术继续使用
,以及(2)我可以使用数据库来弥补差距。


但是......有没有办法将数据传回给调用的asp文件来自

被调用的asp文件?


我当然非常感谢你的帮助!


谢谢,


吉姆

I am trying to replace a huge chunck of code that currently I incorporate
with an #Include directive. The program rarely has to flow through that
code, so I thought it would be better if I used Server.Execute.

I found I can pass data TO the called asp file by creating an HTML <input>
and erading it after I get there.

However, I also need to read back ONE variable that the called file must
set. I cannot figuer out how to do that. My backup positions are (1) I can
keep on using the #Include technique, and (2) I can use a database to bridge
the gap.

BUT... Isn''t there a way to carry data BACK TO the calling asp file FROM
THE CALLED asp file?

I certainly do appreciate the help!

Thanks,

Jim

推荐答案

=?Utf-8?B?SmltIFJvZGdlcnM =?=于2007年8月5日写在

microsoft.public.inetserver.asp.general:
=?Utf-8?B?SmltIFJvZGdlcnM=?= wrote on 05 aug 2007 in
microsoft.public.inetserver.asp.general:

我正在尝试替换当前我用#Include指令合并的大量代码。该程序很少需要通过该代码流入
,所以我认为如果我使用

Server.Execute会更好。


我发现我可以通过创建一个HTML

< input并在我到达后擦除它来将数据传递给被调用的asp文件。


然而,我还需要读回被调用文件

必须设置的一个变量。我无法想象如何做到这一点。我的备份职位

是(1)我可以继续使用#Include技术,(2)我可以使用

a数据库弥补差距。


但是......有没有办法将数据传回给调用的asp文件

来自CALLED的asp文件?
I am trying to replace a huge chunck of code that currently I
incorporate with an #Include directive. The program rarely has to
flow through that code, so I thought it would be better if I used
Server.Execute.

I found I can pass data TO the called asp file by creating an HTML
<inputand erading it after I get there.

However, I also need to read back ONE variable that the called file
must set. I cannot figuer out how to do that. My backup positions
are (1) I can keep on using the #Include technique, and (2) I can use
a database to bridge the gap.

BUT... Isn''t there a way to carry data BACK TO the calling asp file
FROM THE CALLED asp file?



尝试会话变量:


============== test.asp = =================

<%

response.write" running test.asp< br>"

session(" a")=" from test"

response.write" 1-A:"& session(" a")& ;"< br> ==========< br>"


server.execute" testtest.asp"


response.write" running test.asp< br>"

response.write" 2-A:"& session(" a")& "< br>"

response.write" 3-B:"& session(" b")&"< br>"

%>

=================================== =======


============ testtest.asp ================

<%

response.write" running testtest.asp< br>"

session(" b")=" ;来自testtest"

response.wr ite" A:"& session("")&"< br>"

response.write" B:"& session(" b" ;)&"< br> ==========< br>"

%>

===== =====================================


= ====结果来自运行test.asp ======

运行test.asp

1-A:来自测试

==========

运行testtest.asp

答:来自测试

B:来自testtest

==========

运行test.asp

2-A:来自测试

3- B:来自testtest

====================================== ====

-

Evertjan。

荷兰。

(请更改x''我的电子邮件中的点数)

try session variables:

============== test.asp ==================
<%
response.write "running test.asp<br>"
session("a") = "from test"
response.write "1-A: "&session("a")&"<br>==========<br>"

server.execute "testtest.asp"

response.write "running test.asp<br>"
response.write "2-A: "&session("a")&"<br>"
response.write "3-B: "&session("b")&"<br>"
%>
==========================================

============ testtest.asp ================
<%
response.write "running testtest.asp<br>"
session("b") = "from testtest"
response.write "A: "&session("a")&"<br>"
response.write "B: "&session("b")&"<br>==========<br>"
%>
==========================================

===== result from running test.asp ======
running test.asp
1-A: from test
==========
running testtest.asp
A: from test
B: from testtest
==========
running test.asp
2-A: from test
3-B: from testtest
==========================================
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


Server.execute是一个动态包含,因此父文件中定义的任何变量也将在include中包含。文件,因为它们在同一页面范围内执行。

http://support.microsoft.com/kb/224363


Server.execute is a dynamic include, so any variables defined in the parent file will also be availabel in the "include" file, since
they execute within the same page scope.

http://support.microsoft.com/kb/224363



" Evertjan "写道:
"Evertjan." wrote:

=?Utf-8?B?SmltIFJvZGdlcnM =?=于2007年8月5日写在

microsoft.public.inetserver。 asp.general:
=?Utf-8?B?SmltIFJvZGdlcnM=?= wrote on 05 aug 2007 in
microsoft.public.inetserver.asp.general:

我正在尝试替换当前我用#Include指令合并的大量代码。该程序很少需要通过该代码流入
,所以我认为如果我使用

Server.Execute会更好。


我发现我可以通过创建一个HTML

< input并在我到达后擦除它来将数据传递给被调用的asp文件。


然而,我还需要读回被调用文件

必须设置的一个变量。我无法想象如何做到这一点。我的备份职位

是(1)我可以继续使用#Include技术,(2)我可以使用

a数据库弥补差距。


但是......有没有办法将数据传回给调用的asp文件

来自CALLED的asp文件?
I am trying to replace a huge chunck of code that currently I
incorporate with an #Include directive. The program rarely has to
flow through that code, so I thought it would be better if I used
Server.Execute.

I found I can pass data TO the called asp file by creating an HTML
<inputand erading it after I get there.

However, I also need to read back ONE variable that the called file
must set. I cannot figuer out how to do that. My backup positions
are (1) I can keep on using the #Include technique, and (2) I can use
a database to bridge the gap.

BUT... Isn''t there a way to carry data BACK TO the calling asp file
FROM THE CALLED asp file?




尝试会话变量:


-

Evertjan。

荷兰。

(请将x''es更改为我的电子邮件地址中的点数)



try session variables:

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)



谢谢,Evertjan 。我们在项目的早期做出了一个设计决定,并没有使用Session对象 - 出于各种原因,主要与可伸缩性相关,在某种程度上与b $ b相关。但你当然是对的;这将是完美的。


这就是为什么我描述了我的一个后备职位是使用数据库,

这是许多开发人员实现会话功能的方式没有

Session对象。我相信MS电子商务服务器(正确的名字?)是这样做的。


看来,除了Session对象之外,任何变量都是如此。可以通过

到CALLED的asp文件基本上是只读的,因为他们不能更改
更改并传回给CALLING asp文件。


例如,我可以使用

< inputelement在CALLING文件中创建Request.Form(1),我可以在CALLED文件中读取它。但是,这个

表达式不允许在等式的左边,所以看起来我不能改变那个值。


此外,如果我在CALLED文件中创建另一个表单名称/值对,

返回时CALLING文件将无法看到它。


你能想到脚本可以修改CALLED

文件中传递值的任何方式,这样CALLING文件中的脚本就能看到它吗?

Thanks, Evertjan. We made a design decision early on in the project not to
use the Session object -- for various reasons, mostly related to scalability
in some way. But you''re right, of course; that would be perfect.

This is why I described one of my fallback positions to be using a database,
which is the way many developers implement Session functionality without the
Session object. I believe MS eCommerce Server (correct name?) does it that
way.

It seems, except for the Session object, any "variables" that can be passed
TO the CALLED asp file are essentially read-only in the sense they cannot be
changed and passed back to the CALLING asp file.

For example, I can create Request.Form(1) in the CALLING file using an
<inputelement, and I can read it in the CALLED file. However, this
expression is not permitted on the left side of an equation, so it seems I
cannot change that value.

Moreover, if I create yet another Form name / value pair in the CALLED file,
that one will NOT be visible to the CALLING file upon return.

Can you think of any way a script can modify a passed value in the CALLED
file so a script in the CALLING file can see it?


这篇关于如何从server.execute调用返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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