querystring variables in #include files

T

Todd

Hello...I'm trying to include querystring variables in a #include but it's
not working

this works:

<!--#include file="calendar/calendar.asp-->

this does not:

<!--#include
file="calendar/calendar.asp?eventtype=1&curmonth=8&curyear=2006"-->

any suggestions.

Thank You
 
E

Evertjan.

=?Utf-8?B?VG9kZA==?= wrote on 11 aug 2006 in
microsoft.public.inetserver.asp.general:
Hello...I'm trying to include querystring variables in a #include but
it's not working

this works:

<!--#include file="calendar/calendar.asp-->

this does not:

<!--#include
file="calendar/calendar.asp?eventtype=1&curmonth=8&curyear=2006"-->

The second would have no sense, since the <!--#include only inserts the
litteral content of the file, whatever it's extension[!!!], in the calling
file, and does not execute by itself.

This litteral content can be asp code or any other and is,
if it is asp code only executed as part of the "include calling" page.

Why do we often stress include called pages should have a .asp extension?

Because with another extension, say: .txt, .inc, .html, if the page were
accessable from the internet, it's content could be read by anyone.

So request.querystring("eventtype") will only return what is in the main
..asp page, even if this [part of code is in the included file.
 
D

Dave Anderson

Todd said:
Hello...I'm trying to include querystring variables in a
#include but it's not working

Patient: Doctor, it hurts when I do this
Doctor: Then don't do that

Seriously, there is no way to do what you suggest. The included file is
treated like a script fragment and shares form & querystring information
with the enclosing document. In fact, the entire document is parsed as one
document ONLY AFTER all of the include files are assembled.
http://msdn.microsoft.com/library/en-us/iissdk/html/e81bb5a5-1271-40ce-adfb-e76dc027a608.asp

I suspect from your example that you might get what you want from
Server.Execute()
http://msdn.microsoft.com/library/en-us/iissdk/html/db562da1-d49d-4fe5-9747-64ef530de23f.asp
 
T

Todd

Thank you...yes..I forgot about how it works

Dave Anderson said:
Patient: Doctor, it hurts when I do this
Doctor: Then don't do that

Seriously, there is no way to do what you suggest. The included file is
treated like a script fragment and shares form & querystring information
with the enclosing document. In fact, the entire document is parsed as one
document ONLY AFTER all of the include files are assembled.
http://msdn.microsoft.com/library/en-us/iissdk/html/e81bb5a5-1271-40ce-adfb-e76dc027a608.asp

I suspect from your example that you might get what you want from
Server.Execute()
http://msdn.microsoft.com/library/en-us/iissdk/html/db562da1-d49d-4fe5-9747-64ef530de23f.asp



--
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.
 

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

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top