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 17 7145
=?Utf-8?B?SmltIFJvZGd lcnM=?= wrote on 05 aug 2007 in
microsoft.publi c.inetserver.as p.general:
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?
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.a sp"
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 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." wrote:
=?Utf-8?B?SmltIFJvZGd lcnM=?= wrote on 05 aug 2007 in
microsoft.publi c.inetserver.as p.general:
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?
try session variables:
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
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?
"Jon Paal [MSMD]" wrote:
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
Thank you, Jon Paal. The variables that are available to the script in the
CALLED file are the ASP object variables like Server, Request, Response,
Application, etc., and most importantly, variables in the Session object.
The VBScript variables do not scope beyond the CALLING file as they do with
the #Include directive. It's very frustrating.
BTW, the article you mentioned has some problems; I think they should pull
it. For example, the data stream to the client includes...
<html>
<body>
<html>
<body>
....
</body>
</html>
</body>
</html>
....which works, but, well they need to do more than just test their examples.
An excellent (albeit somewhat verbose) alternative article is this one: http://msdn.microsoft.com/msdnmag/issues/0400/redir/
Yet even that one fails to mention (I think) the subject of returning (or
not...) values back to the CALLING script.
Can you think of any other ways?
Thanks,
Jim
"Jim Rodgers" <Ji********@dis cussions.micros oft.comwrote in message
news:63******** *************** ***********@mic rosoft.com...
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!
For this scenario the next step from an include file is a VB6 dll. Of
course for various reasons that may not be an option.
For an include file that contains a large set of functions enclosing them in
a class helps to keep the global namespace free.
Server.Execute is not an appropriate solution.
How have you determined that having a large include file is a problem?
--
Anthony Jones - MVP ASP/ASP.NET
"Anthony Jones" wrote:
>
For this scenario the next step from an include file is a VB6 dll. Of
course for various reasons that may not be an option.
For an include file that contains a large set of functions enclosing them in
a class helps to keep the global namespace free.
Server.Execute is not an appropriate solution.
How have you determined that having a large include file is a problem?
--
Anthony Jones - MVP ASP/ASP.NET
Thanks, Anthony!
I have not yet determined that having a large include file is a problem. I
may keep what I have until it is a problem. However, I am not only creating
a specific web application, but I am trying to keep my options open for code
reuse since the project is turning into a decent platform for more work.
Your idea about a VB6 DLL is excellent. I am planning to replace a lot of
my #Includes (containing my VBScript Subs and Functions "library") with a DLL
soon. But it will make more sense to you and everyone if I mention one more
aspect of the problem I have in the current case.
The subject asp file (which currently is #Included and which I would prefer
to be Server.Execute' d) processes a huge number of Request.Form(i) variables
for all kinds of input validation requirements. It is because of the
Request.Form(i) variables that I felt Server.Execute would be a good choice.
I hate having to pass all these TO the CALLED file.
Since no one could tell me about [an obscure] technique for getting one or
two answers back to the CALLING script, I have decided to write the
validation results to a database. Thus, I need only to check the database
when I return to the first file. Previously, I acted on the validation
results (with Response.Write' s) in the CALLED file. Now I will simply do
that after I return. Even though the second file now does no output to the
client side, it still makes sense to use Server.Execute because of the sheer
volume of Request.Form(i) variables.
Would you agree?
Thanks again for your remarks.
Jim
>
Yet even that one fails to mention (I think) the subject of returning (or
not...) values back to the CALLING script.
Can you think of any other ways?
Thanks,
Jim
You don't have to "return" them as they are avaiable as part of the parent page scope. Just use the variable.
"Jon Paal [MSMD]" wrote:
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
Absolutely nothing in that article suggests such a thing, and it certainly
is false. Maybe you are thinking of Server.Transfer .
Te following are shared, which is a far cry from "any variables":
- Application variables
- Session properties
- Server variables and properties
- Request collections and properties
- Response collections and properties http://msdn2.microsoft.com/en-us/library/ms525849.aspx
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
=?Utf-8?B?SmltIFJvZGd lcnM=?= wrote on 05 aug 2007 in
microsoft.publi c.inetserver.as p.general:
"Evertjan." wrote:
>=?Utf-8?B?SmltIFJvZGd lcnM=?= wrote on 05 aug 2007 in microsoft.publ ic.inetserver.a sp.general:
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?
try session variables:
>
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.
That is duplicating the session object, and if that is done well, the
solution should work the same.
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.
I don't see why not. A "variable" stored in a database should have the
same workings as using the session database structure.
For example, I can create Request.Form(1) in the CALLING file using an
<inputelement , and I can read it in the CALLED file.
But that is not using a serverside daabase.
However, this
expression is not permitted on the left side of an equation, so it
seems I cannot change that value.
And rightly so.
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?
I personally think you should keep to includes
or change your design decision.
It is never to late to improve on design decisions,
they are only to be kept static at your peril.
In the end:
What is wrong with an include,
where the whole code is contained in:
If Not myBoolean Then
' whole code
End If
as opposed to a statement line
If Not myBoolean Then Server.execute "...."
?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vipul Pathak |
last post by:
Hello Friends !
I have the Following Code, that Executes a Stored Procedure and Attempt to
read a Returned Integer Value from the StoredProc.
But It gives Error ...
ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/C4U/DBOutputParameterTest.asp, line 25
|
by: Paul |
last post by:
Hi,
In SQL Books Online in the section on @@Error it gives the following
example:
-- Execute the INSERT statement.
INSERT INTO authors
(au_id, au_lname, au_fname, phone, address,
city, state, zip, contract) values
(@au_id,@au_lname,@au_fname,@phone,@address,
|
by: Hardy Wang |
last post by:
Hi all,
I have the following codes, but SCOPE_IDENTITY() just returns NULL to
me. If I comment out SCOPE_IDENTITY() line and run @@IDENTITY line, it works
fine!! Since I have a trigger on the table, I have to use SCOPE_IDENTITY().
Any ideas?
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
//Create the dataadapter
|
by: Rudy |
last post by:
Hello All!
I have a value in a textbox(txbTableIDm.Text ) that I would like to use in a
paremiter in a SP I wrote, and then have the select statement work off that
parememter, retireive a diffrent value in another(txbCredits) texbox. Heres
the code:
Public Sub GetCredit()
Dim ConCred As SqlConnection
Dim strCred As String
Dim cmdCred As SqlCommand
|
by: solomon_13000 |
last post by:
The code bellow functions well. However if I want to obtain a return
value using the code bellow, how is it done?
<%
Sub RunQueryString (pSQL,parms)
on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
Set cmd = Server.CreateObject("adodb.command")
| |
by: Mick Walker |
last post by:
Hi Everyone,
I am stumped here. I have the following stored proceedure:P
CREATE PROCEDURE .
@SupplierSKU varchar(50),
@RetVal int
AS
Select @Retval = count(*) from dbo.ImportLines
Where = @SupplierSKU
|
by: gopi2ks |
last post by:
Dear All,
I have one stored procedure like sp_insertEmployee
Employee Table Fileds
Eno int pk,
ename varchar(100),
designation varchar
|
by: Dooza |
last post by:
I have a stored procedure that takes a number of inputs, does a bulk
insert, and then outputs a recordset. When I run the stored procedure in
Server Management Studio I also get a return value from the stored
procedure which is an INT.
I want to access this return value on my ASP/VBScript page, but do not
know how to access it.
Here is my code so far:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |