querystring variables in #include files

Discussion in 'ASP General' started by Todd, Aug 11, 2006.

  1. Todd

    Todd Guest

    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
     
    Todd, Aug 11, 2006
    #1
    1. Advertising

  2. Todd

    Evertjan. Guest

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

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Aug 11, 2006
    #2
    1. Advertising

  3. Todd wrote:
    > 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



    --
    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.
     
    Dave Anderson, Aug 11, 2006
    #3
  4. Todd

    Todd Guest

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

    "Dave Anderson" wrote:

    > Todd wrote:
    > > 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
    >
    >
    >
    > --
    > 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.
    >
    >
    >
     
    Todd, Aug 11, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mehdi
    Replies:
    6
    Views:
    36,174
    sloan
    Apr 6, 2006
  2. Andreas Bogenberger
    Replies:
    3
    Views:
    958
    Andreas Bogenberger
    Feb 22, 2008
  3. Replies:
    9
    Views:
    985
  4. mark4asp
    Replies:
    1
    Views:
    225
  5. Adeel Ahmad
    Replies:
    1
    Views:
    561
    Anthony Jones
    Mar 7, 2006
Loading...

Share This Page