PLEASE HELP: Dynamic Includes

Results 1 to 2 of 2

Thread: PLEASE HELP: Dynamic Includes

  1. #1
    Join Date
    Dec 1969

    Default PLEASE HELP: Dynamic Includes

    I am trying to do a dynamic include based on a database column called "filename." I am attempting to do this using SERVER.EXECUTE.<BR><BR>The problem I am running into is that the included filename (i.e. "filename") requires an id from the main file. When I try to include a querystring in the Server.Execute, I get an error:<BR>"Invalid URL form or fully-qualified absolute URL was used. Use relative URLs."<BR><BR>For example,<BR>"Server.Execute TestFile.asp?Test_id=199"<BR>gives me the above error whereas <BR>"Server.Execute TestFile.asp"<BR>works OK, but then I cannot pass the id to the included file.<BR><BR>Is there any way to include a file and pass it a querystring at the end?<BR><BR>Regards,<BR>Mitchell<BR>

  2. #2
    Join Date
    Dec 1969

    Default He means Server.Execute

    Which is good, since you can&#039;t *do* dynamic #include&#039;s in ASP.<BR><BR>Anyway: The reason you can&#039;t pass a query string with Server.Execute is given in the description of what it does: It executes the secondary script *IN THE CONTEXT* of the original page!<BR><BR>But the *CONTEXT* of the original page *includes* Request.Form and Request.QueryString and and and... *IF* you succeeded in passing a query string to the executed page, you&#039;d be destroying the context of the original query string! (Granted, there might not *be* a query string for the current page, but ASP doesn&#039;t know that and assumes you are doing bad things.)<BR><BR>What you can do...<BR><BR>You can create a Session variable! Yes, the session variables are *also* part of the "Context". But *adding* a variable doesn&#039;t constitute a change, per se, to the Context, so it is allowed. <BR><BR>Worried about performance? Don&#039;t be! You can add a Session variable in the primary page, get its value in the Executed page, and then *immediately* do Session.Contents.Clear [is that the right call? well...look it up] to get rid of the value. You haven&#039;t tied up memory with a session variable for 20 minutes...only for a few microseconds. Trust me, even the busiest site wouldn&#039;t see that "hiccup."<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts