By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

session variable in an include file

P: n/a
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

Oct 15 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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)
Oct 15 '06 #2

P: n/a
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"
Oct 15 '06 #3

P: n/a
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)
Oct 15 '06 #4

P: n/a
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)
Oct 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.