Session variables lost across pages

A

Adam

Hi All,

My Session variables are not being kept across .asp pages.

I have written two test pages that do nothing else.

When page two is displayed the Session variable is undefined.

I have read http://www.aspfaq.com/show.asp?id=2157.
.. 'Enable session state'is enabled for the website.
.. I am running IE6 on WinXP SP1. All my browser Security settings
are set to the default levels.

What am I missing ?

Thanks in advance.
Adam

TESTONE.ASP

<%@ language=javascript%>
<% Response.Buffer = true;%>
..
..
<%
var foo = "foo";
if (typeof(Session("test")) == 'undefined') {
Session("test") = foo;
}
%>
<table>
<tr><td>Session variable test = <%=Session("test")%></td></tr>
<tr><td><A href="testtwo.asp">Go to page two</a></td></tr>
</table>
..
..

TESTTWO.ASP
<%@ language=javascript%>
<% Response.Buffer = true;%>
..
..
<table>
<tr><td><%=typeof(Session("test"))%></td></tr>
<tr><td>Session variable test = <%=Session("test")%></td></tr>
</table>
 
A

Aaron Bertrand [MVP]

Do you get an error that says variable is undefined, or you assuming it's
undefined because it is empty, null, blank string, etc?
 
J

J. Baute

Hi All,

My Session variables are not being kept across .asp pages.

I have written two test pages that do nothing else.

When page two is displayed the Session variable is undefined.

I have read http://www.aspfaq.com/show.asp?id=2157.
. 'Enable session state'is enabled for the website.
. I am running IE6 on WinXP SP1. All my browser Security settings
are set to the default levels.

What am I missing ?

Thanks in advance.
Adam

TESTONE.ASP

<%@ language=javascript%>
<% Response.Buffer = true;%>
.
.
<%
var foo = "foo";
if (typeof(Session("test")) == 'undefined') {
Session("test") = foo;
}
%>
<table>
<tr><td>Session variable test = <%=Session("test")%></td></tr>
<tr><td><A href="testtwo.asp">Go to page two</a></td></tr>
</table>
.
.

TESTTWO.ASP
<%@ language=javascript%>
<% Response.Buffer = true;%>
.
.
<table>
<tr><td><%=typeof(Session("test"))%></td></tr>
<tr><td>Session variable test = <%=Session("test")%></td></tr>
</table>

try again using a different browser,
if it doesn't work in eg. Mozilla either, it's not an IE issue (like cookies etc)
 
A

Adam

Aaron Bertrand said:
Do you get an error that says variable is undefined, or you assuming it's
undefined because it is empty, null, blank string, etc?

When the test statement is evaluated on TESTONE.ASP, the output is
"Session variable test = foo"

On TESTTWO.ASP the variable has been lost so
typeof(Session("test")) == undefined

Adam
 
D

David C. Holley

Try a test where you set the session variable and then display it on the
same page as in...

session("rr_org") = "Hello World"
response.write "-" & session("rr_org") "-"

The "-" help to confirm that the var is empty btw.
 
V

Vilmar

Hi,
Take a look at your iis webserver and check if it is capable to keep session
state.
In Ms-IIS 5.0 the way is:
properties
tab base folder
button configuration
tab application option
so activate the option which enable session state.
bye
 
D

Dave Anderson

Adam said:
...When page two is displayed the Session variable is undefined...

Besides the other suggestions, you may want to check the session timeout and
the Session_OnStart handler in your global.asa. For that matter, put the
page in an *application* and see if that matters.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
A

Adam

Thanks to all who answered.

A personal Firewall was the cause. Obviuosly blocking what is an
unkown process at this point.

The 'fix' came by accident. Hadnt even thought that could be the
probably as I am running the IIS server locally.

Thanks,
Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top