Passing Parameters to Server.Execute or #Include ?

B

Bill

I need to pass a static parameter to an included ASP file. I'm thinking
about using this with a query string, but upon reflection I'm not sure how I
can do this. For example:

---file start: FIRST.ASP ------
<%
Server.Execute("second.asp?a=1")
%>

<!--- ***** or ***** --->

<!-- #include file="second.asp?a=2" -->

-----file end: FIRST.ASP --------------

Now, if I do a Request.QueryString("a") in second.asp, is it performing a
query on FIRST.ASP then? How can I retrieve the parameter?
 
B

Bob Barrows [MVP]

Bill said:
I need to pass a static parameter to an included ASP file. I'm
thinking about using this with a query string, but upon reflection
I'm not sure how I can do this. For example:

---file start: FIRST.ASP ------
<%
Server.Execute("second.asp?a=1")
%>

<!--- ***** or ***** --->

<!-- #include file="second.asp?a=2" -->

-----file end: FIRST.ASP --------------

Now, if I do a Request.QueryString("a") in second.asp, is it
performing a query on FIRST.ASP then? How can I retrieve the
parameter?

Yes. Try it. You'll see.
 
B

Bob Lehmann

I did. Didn't work. I'm hoping someone smarter than you knows the answer.

Nice.

Good luck, Bill, in getting any further assistance. I'd venture to say you
are on your own now.

Bob Lehmann
 
B

Bob Barrows [MVP]

Bill said:
I did. Didn't work. I'm hoping someone smarter than you knows the
answer.

Bill.

Silly. I was answering "yes" to your first question: "is it performing a
query on FIRST.ASP then?". I don't tend to answer "yes" to a question that
begins with "How".

Speaking of smarts, if you know enough to put "?a=2" into your #include
statement, why aren't you smart enough to simply put

dim a
a=2

into FIRST.asp? Then simply reference the a variable in second.asp (this
won't work with server.execute, but should work fine with a #include)
 
B

Bill

Bob Barrows said:
Silly. I was answering "yes" to your first question: "is it performing a
query on FIRST.ASP then?". I don't tend to answer "yes" to a question that
begins with "How".

Speaking of smarts, if you know enough to put "?a=2" into your #include
statement, why aren't you smart enough to simply put

dim a
a=2

into FIRST.asp? Then simply reference the a variable in second.asp (this
won't work with server.execute, but should work fine with a #include)

This did exactly what I want. Thanks, Bob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top