Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Session variables lost across pages (http://www.velocityreviews.com/forums/t794160-session-variables-lost-across-pages.html)

Adam 04-26-2004 10:47 PM

Session variables lost across pages
 
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>

Aaron Bertrand [MVP] 04-27-2004 03:05 AM

Re: Session variables lost across pages
 
Do you get an error that says variable is undefined, or you assuming it's
undefined because it is empty, null, blank string, etc?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/







"Adam" <areynoldsx@hotmail.com> wrote in message
news:a84b035a.0404261447.248c70f6@posting.google.c om...
> 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>




J. Baute 04-27-2004 08:01 AM

Re: Session variables lost across pages
 
areynoldsx@hotmail.com (Adam) wrote in message news:<a84b035a.0404261447.248c70f6@posting.google. com>...
> 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)

Adam 04-27-2004 12:00 PM

Re: Session variables lost across pages
 
"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message news:<uzIuOSALEHA.3712@TK2MSFTNGP11.phx.gbl>...
> Do you get an error that says variable is undefined, or you assuming it's
> undefined because it is empty, null, blank string, etc?
>
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>


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
>
>
>
>
>
> "Adam" <areynoldsx@hotmail.com> wrote in message
> news:a84b035a.0404261447.248c70f6@posting.google.c om...
> > 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>


David C. Holley 04-27-2004 02:39 PM

Re: Session variables lost across pages
 
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.



J. Baute wrote:
> areynoldsx@hotmail.com (Adam) wrote in message news:<a84b035a.0404261447.248c70f6@posting.google. com>...
>
>>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)



Vilmar 04-27-2004 03:14 PM

Re: Session variables lost across pages
 
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
--



Vilmar Braz„o de Oliveira

"Adam" <areynoldsx@hotmail.com> escreveu na mensagem
news:a84b035a.0404261447.248c70f6@posting.google.c om...
> 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>




Aaron Bertrand [MVP] 04-27-2004 03:21 PM

Re: Session variables lost across pages
 
Please try a different browser, and go through *every* bullet item in
http://www.aspfaq.com/2157

If you find out that it was caused by something not in that article, please
let me know, because it will be news for me.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/





"Adam" <areynoldsx@hotmail.com> wrote in message
news:a84b035a.0404270400.9fe8c72@posting.google.co m...
> "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
> news:<uzIuOSALEHA.3712@TK2MSFTNGP11.phx.gbl>...
>> Do you get an error that says variable is undefined, or you assuming it's
>> undefined because it is empty, null, blank string, etc?
>>
>> --
>> Aaron Bertrand
>> SQL Server MVP
>> http://www.aspfaq.com/
>>

>
> 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
>>
>>
>>
>>
>>
>> "Adam" <areynoldsx@hotmail.com> wrote in message
>> news:a84b035a.0404261447.248c70f6@posting.google.c om...
>> > 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>




Dave Anderson 04-27-2004 03:59 PM

Re: Session variables lost across pages
 
Adam wrote:
>
> ...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.



Adam 04-28-2004 08:48 AM

Re: Session variables lost across pages
 
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


All times are GMT. The time now is 11:04 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.