Need help using #Include in Classic ASP

Discussion in 'C#' started by midnighthost, Nov 11, 2009.

  1. #1
    I would like to have one .asp file called HomePage.asp containing the following 2 lines:

    <% myFile = "HomePage1.asp" %>
    <!--#include file="MyOuterShell.asp"-->

    and MyOuterShell.asp will contain the working equivalent of:

    <!--#include file="<%=myFile%>"-->


    I am attempting to have an outer ASP shell that will be the same for all pages of my site and construct include files for additional pages.

    When I test and click view source, I can see the #Include directive.
    It is not being processed before the page is shown.

    Can anyone tell me what I might be doing incorrectly.
     
    Last edited: Nov 11, 2009
    midnighthost, Nov 11, 2009 IP
  2. RonBrown

    RonBrown Well-Known Member

    Messages:
    934
    Likes Received:
    55
    Best Answers:
    4
    Trophy Points:
    105
    #2
    That line is probably what is causing the problem. The include file cannot contain an asp directive because ASP cannot parse it.

    You will have to include the proper file name in the statement i.e. replace <%=myFile%> with the name of the actual file.
     
    RonBrown, Nov 11, 2009 IP
  3. ClientDigger

    ClientDigger Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  4. nadiralishah_webexpert

    nadiralishah_webexpert Guest

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    your file MyOuterShell.asp cant recognize the variable myFile that you initialized at HomePage.asp.
     
    nadiralishah_webexpert, Feb 6, 2010 IP