session variable in an include file

Discussion in 'ASP General' started by spectre, Oct 15, 2006.

  1. spectre

    spectre Guest

    Hello,

    I first create a session variable 'client' in the login.asp file
    The login.asp file opens a file (xxx.asp) with an include file
    ..
    If I write
    <!--#include file="../../../data/" & session("client") &
    "/language_ger.inc"-->
    I have a message stating that the application can't find the file.

    If I write the path without the variable (" & session("client") & ")
    <!--#include file="../../../data/eurovini/language_ger.inc"-->
    it works without any problem.

    Question
    - is there is an error in the syntax?
    - is it possible to include this kind of variable in an include file.
    And if not, any idea to get the same result?

    Thanks for your help. Bye
     
    spectre, Oct 15, 2006
    #1
    1. Advertising

  2. spectre

    Evertjan. Guest

    spectre wrote on 15 okt 2006 in microsoft.public.inetserver.asp.general:

    > <!--#include file="../../../data/" & session("client") &
    > "/language_ger.inc"-->
    >


    You cannot use asp code in an include declaration.

    The include first inserts the text content in the file,
    and THEN the total is read by the asp interpretor,
    rendering the html for the stream to clientside.

    Try:

    <% ' vbscript assumed
    server.execute "../../../data/" & session("client") & "/lang.asp"
    %>

    This cannot be the same file,
    as server.execute will execute asp code without the <%..%>

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

  3. spectre wrote:
    > Hello,
    >
    > I first create a session variable 'client' in the login.asp file
    > The login.asp file opens a file (xxx.asp) with an include file
    > .
    > If I write
    > <!--#include file="../../../data/" & session("client") &


    http://www.aspfaq.com/show.asp?id=2042
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Oct 15, 2006
    #3
  4. spectre

    spectre Guest

    Thanks for your help. I am gone try it , soon.


    Bye



    Evertjan. wrote:
    > spectre wrote on 15 okt 2006 in microsoft.public.inetserver.asp.general:
    >
    > > <!--#include file="../../../data/" & session("client") &
    > > "/language_ger.inc"-->
    > >

    >
    > You cannot use asp code in an include declaration.
    >
    > The include first inserts the text content in the file,
    > and THEN the total is read by the asp interpretor,
    > rendering the html for the stream to clientside.
    >
    > Try:
    >
    > <% ' vbscript assumed
    > server.execute "../../../data/" & session("client") & "/lang.asp"
    > %>
    >
    > This cannot be the same file,
    > as server.execute will execute asp code without the <%..%>
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    spectre, Oct 15, 2006
    #4
  5. spectre

    Evertjan. Guest

    spectre wrote on 15 okt 2006 in microsoft.public.inetserver.asp.general:

    > Thanks for your help. I am gone try it , soon.


    [Please do not toppost on usenet]

    gone soon?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Oct 15, 2006
    #5
    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. Victor Bazarov

    #include "file" -vs- #include <file>

    Victor Bazarov, Mar 5, 2005, in forum: C++
    Replies:
    4
    Views:
    549
    Exits Funnel
    Mar 6, 2005
  2. PTM
    Replies:
    1
    Views:
    340
    Andy Dingley
    Nov 12, 2007
  3. naveeddil
    Replies:
    0
    Views:
    590
    naveeddil
    Jan 4, 2008
  4. Andreas Bogenberger
    Replies:
    3
    Views:
    957
    Andreas Bogenberger
    Feb 22, 2008
  5. Eric
    Replies:
    10
    Views:
    483
Loading...

Share This Page