Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > session variable in an include file

Reply
Thread Tools

session variable in an include file

 
 
spectre
Guest
Posts: n/a
 
      10-15-2006
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

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-15-2006
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)
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-15-2006
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"


 
Reply With Quote
 
spectre
Guest
Posts: n/a
 
      10-15-2006
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)


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-15-2006
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
ASP Include file error <!-- #include file="" --> naveeddil ASP .Net 0 01-04-2008 12:58 PM
include file in include file PTM HTML 1 11-12-2007 10:13 AM
#include "file" -vs- #include <file> Victor Bazarov C++ 4 03-06-2005 07:09 PM



Advertisments