473,486 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Session variables

Hi all,

Is there any limit to the number of session variables a site can have? And
is that affected by global.asa at all?

The reason why i ask is that i have a relatively simple site that relies on
about 40 sesion variables and a mixture of vbs and js files. One of the
session variables is an id number that gets incremented to point to the next
piece of data to be displayed. This variable is initialised on the first
page of the site and then incremented. However, if you quit the site, and
then access the site again, this variable is not reset to its initial value.

Any ideas?

Martin
Jun 1 '06 #1
14 2887
Martin Walke wrote:
Hi all,

Is there any limit to the number of session variables a site can
have? And is that affected by global.asa at all?

The reason why i ask is that i have a relatively simple site that
relies on about 40 sesion variables and a mixture of vbs and js
files. One of the session variables is an id number that gets
incremented to point to the next piece of data to be displayed. This
variable is initialised on the first page of the site and then
incremented. However, if you quit the site, and then access the site
again, this variable is not reset to its initial value.

Unless you close all browser windows that were open when the session was
begun, you will not get a new session.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 1 '06 #2
> Unless you close all browser windows that were open when the session was
begun, you will not get a new session.
Thanks Bob but yep - knew that. But in this case, I'm setting the variable
to its initial value but that doesn't seem to be happening. So i'm just
wondering what would stop a session variable from being updated to a new
value.

Martin

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uP**************@TK2MSFTNGP02.phx.gbl... Martin Walke wrote:
Hi all,

Is there any limit to the number of session variables a site can
have? And is that affected by global.asa at all?

The reason why i ask is that i have a relatively simple site that
relies on about 40 sesion variables and a mixture of vbs and js
files. One of the session variables is an id number that gets
incremented to point to the next piece of data to be displayed. This
variable is initialised on the first page of the site and then
incremented. However, if you quit the site, and then access the site
again, this variable is not reset to its initial value.

Unless you close all browser windows that were open when the session was
begun, you will not get a new session.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jun 1 '06 #3
Martin Walke wrote:
Unless you close all browser windows that were open when the session
was begun, you will not get a new session.
Thanks Bob but yep - knew that. But in this case, I'm setting the
variable to its initial value but that doesn't seem to be happening.


When/where are you doing that?
So i'm just wondering what would stop a session variable from being
updated to a new value.

Nothing that I know of.
Could you explain the process in a little more detail?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 1 '06 #4
Martin Walke wrote:
Unless you close all browser windows that were open when the session
was begun, you will not get a new session.


Thanks Bob but yep - knew that. But in this case, I'm setting the
variable to its initial value but that doesn't seem to be happening.
So i'm just wondering what would stop a session variable from being
updated to a new value.

I suspect that what is happening is that you are not getting a new
session when you expect to be getting one. The best way to confirm this
is to display the session id, which should change when a new session is
started.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 1 '06 #5
Bob Barrows [MVP] wrote:
Unless you close all browser windows that were open when
the session was begun, you will not get a new session.


Well, that's not entirely true. You ought to get a new one after
Session.Abandon().

--
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.
Jun 1 '06 #6
Thanks for the responses guys.

OK.. maybe I'm confused about session variables. My site opens in a new
window from a link. I have a line

<%
....
session("qid") = 0
....
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next page
increments this session variable and after user interaction, the page is
shown again (but with different info) based on the value of 'qid'.

<%
....
session("qid") = session("qid") + 1
....
%>

If the user then quits this site (but doesn't close all browser windows) and
then returns to the site, the session variable is not reset to 0 on the
first page.

The real rub here is that it works on 3 other servers, plus PWS, but not on
the client's live server. What gives?

Martin

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
Bob Barrows [MVP] wrote:
Unless you close all browser windows that were open when
the session was begun, you will not get a new session.


Well, that's not entirely true. You ought to get a new one after
Session.Abandon().

--
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.

Jun 2 '06 #7
Martin Walke wrote on 02 jun 2006 in
microsoft.public.inetserver.asp.general:
OK.. maybe I'm confused about session variables. My site opens in a
new window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next
page increments this session variable and after user interaction, the
page is shown again (but with different info) based on the value of
'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser
windows) and then returns to the site, the session variable is not
reset to 0 on the first page.

The real rub here is that it works on 3 other servers, plus PWS, but
not on the client's live server. What gives?


It should "work". Try making a minimalistic test set of files and try it
again. Also try it with other browsers and from othe url's.

==========================

Why not use a "work-around" and do the initializing on the counting page?
This is a must anyway if that page is accessable after timeout or from an
external link or bookmark anyway:

<%
....
if session("qid") = "" then session("qid") = 0
session("qid") = session("qid") + 1
....
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 2 '06 #8
Ermmmm.... this might be a silly question, but have you checked to see
if Enable Session State has been checked in the Application
configuration on your client's server?

--
Mike Brind

Martin Walke wrote:
Thanks for the responses guys.

OK.. maybe I'm confused about session variables. My site opens in a new
window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next page
increments this session variable and after user interaction, the page is
shown again (but with different info) based on the value of 'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser windows) and
then returns to the site, the session variable is not reset to 0 on the
first page.

The real rub here is that it works on 3 other servers, plus PWS, but not on
the client's live server. What gives?

Martin

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
Bob Barrows [MVP] wrote:
Unless you close all browser windows that were open when
the session was begun, you will not get a new session.


Well, that's not entirely true. You ought to get a new one after
Session.Abandon().

--
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.


Jun 2 '06 #9
Thanks Mike. No I haven't but only as they use Session variables for various
security checks etc and have therefore assumed (cough) that that side would
be OK. I'll double check though.

It may be that this is not really an ASP problem but an IIS problem and is
being visualised as a session variable issue.

Martin
"Mike Brind" <pa*******@hotmail.com> wrote in message
news:11*********************@h76g2000cwa.googlegro ups.com...
Ermmmm.... this might be a silly question, but have you checked to see
if Enable Session State has been checked in the Application
configuration on your client's server?

--
Mike Brind

Martin Walke wrote:
Thanks for the responses guys.

OK.. maybe I'm confused about session variables. My site opens in a new
window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next page
increments this session variable and after user interaction, the page is
shown again (but with different info) based on the value of 'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser windows)
and
then returns to the site, the session variable is not reset to 0 on the
first page.

The real rub here is that it works on 3 other servers, plus PWS, but not
on
the client's live server. What gives?

Martin

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
> Bob Barrows [MVP] wrote:
>> Unless you close all browser windows that were open when
>> the session was begun, you will not get a new session.
>
> Well, that's not entirely true. You ought to get a new one after
> Session.Abandon().
>
>
>
> --
> 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.
>

Jun 2 '06 #10
> Why not use a "work-around" and do the initializing on the counting page?
This is a must anyway if that page is accessable after timeout or from an
external link or bookmark anyway:
Thanks Evertjan. That's certainly something I can do anyway but perhaps the
symtoms are pointing to something else being wrong and it's just manifesting
itself as the inability to set session variables.

Martin
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242... Martin Walke wrote on 02 jun 2006 in
microsoft.public.inetserver.asp.general:
OK.. maybe I'm confused about session variables. My site opens in a
new window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next
page increments this session variable and after user interaction, the
page is shown again (but with different info) based on the value of
'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser
windows) and then returns to the site, the session variable is not
reset to 0 on the first page.

The real rub here is that it works on 3 other servers, plus PWS, but
not on the client's live server. What gives?


It should "work". Try making a minimalistic test set of files and try it
again. Also try it with other browsers and from othe url's.

==========================

Why not use a "work-around" and do the initializing on the counting page?
This is a must anyway if that page is accessable after timeout or from an
external link or bookmark anyway:

<%
...
if session("qid") = "" then session("qid") = 0
session("qid") = session("qid") + 1
...
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jun 2 '06 #11
Finally found the problem. I hadn't placed an expires=-1 on the pages.
Didn't think it was necessary. However, the site was being run through a
proxy server which, of course, was caching the page. Mental note to oneself,
if using session variables, use expires=-1 as well!!

Thanks all, for your input.

Martin
"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_uk> wrote in message
news:em**************@TK2MSFTNGP05.phx.gbl...
Thanks Mike. No I haven't but only as they use Session variables for
various security checks etc and have therefore assumed (cough) that that
side would be OK. I'll double check though.

It may be that this is not really an ASP problem but an IIS problem and is
being visualised as a session variable issue.

Martin
"Mike Brind" <pa*******@hotmail.com> wrote in message
news:11*********************@h76g2000cwa.googlegro ups.com...
Ermmmm.... this might be a silly question, but have you checked to see
if Enable Session State has been checked in the Application
configuration on your client's server?

--
Mike Brind

Martin Walke wrote:
Thanks for the responses guys.

OK.. maybe I'm confused about session variables. My site opens in a new
window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next
page
increments this session variable and after user interaction, the page is
shown again (but with different info) based on the value of 'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser windows)
and
then returns to the site, the session variable is not reset to 0 on the
first page.

The real rub here is that it works on 3 other servers, plus PWS, but not
on
the client's live server. What gives?

Martin

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
> Bob Barrows [MVP] wrote:
>> Unless you close all browser windows that were open when
>> the session was begun, you will not get a new session.
>
> Well, that's not entirely true. You ought to get a new one after
> Session.Abandon().
>
>
>
> --
> 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.
>


Jun 5 '06 #12
Martin Walke wrote on 05 jun 2006 in
microsoft.public.inetserver.asp.general:
Finally found the problem. I hadn't placed an expires=-1 on the pages.
Didn't think it was necessary. However, the site was being run through
a proxy server which, of course, was caching the page.
Why not expires = -100 ?

If the client GMT is 2 minutes off, the effective timeout is +1 minute.

True, gugus?
Mental note to
oneself, if using session variables, use expires=-1 as well!!


Only if the session variables are not all session static in their value.

If the sesson variable only shows the login name, it isn't changing
throughout the session once set.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 5 '06 #13

"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_uk> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Finally found the problem. I hadn't placed an expires=-1 on the pages.
Didn't think it was necessary. However, the site was being run through a
proxy server which, of course, was caching the page. Mental note to oneself, if using session variables, use expires=-1 as well!!

You are correct that Expires shouldn't be necessary since ASP doesn't
generate cacheable content.

So either your ASP is generating headers which makes the proxy server think
the content is cacheable or
the proxy server is making 'intelligent' choices about whether to cache what
strictly speaking it shouldn't.

For example if your ASP page generates the exact same content every time for
a given request a proxy server might assume that it can safely cache the
response.

For belts and braces prevention of caching use:-

Response.Expires = -1440 ' 1 day old
Response.CacheControl = "private, no-cache, max-age=0" 'Only works with
HTTP/1.1 compliant proxies

Anthony
Thanks all, for your input.

Martin
"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_uk> wrote in message
news:em**************@TK2MSFTNGP05.phx.gbl...
Thanks Mike. No I haven't but only as they use Session variables for
various security checks etc and have therefore assumed (cough) that that
side would be OK. I'll double check though.

It may be that this is not really an ASP problem but an IIS problem and is being visualised as a session variable issue.

Martin
"Mike Brind" <pa*******@hotmail.com> wrote in message
news:11*********************@h76g2000cwa.googlegro ups.com...
Ermmmm.... this might be a silly question, but have you checked to see
if Enable Session State has been checked in the Application
configuration on your client's server?

--
Mike Brind

Martin Walke wrote:
Thanks for the responses guys.

OK.. maybe I'm confused about session variables. My site opens in a new window from a link. I have a line

<%
...
session("qid") = 0
...
%>
that is on the first page of my site. This session variable is used to
determine what information is to be shown on the next page. The next
page
increments this session variable and after user interaction, the page is shown again (but with different info) based on the value of 'qid'.

<%
...
session("qid") = session("qid") + 1
...
%>

If the user then quits this site (but doesn't close all browser windows) and
then returns to the site, the session variable is not reset to 0 on the first page.

The real rub here is that it works on 3 other servers, plus PWS, but not on
the client's live server. What gives?

Martin

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
> Bob Barrows [MVP] wrote:
>> Unless you close all browser windows that were open when
>> the session was begun, you will not get a new session.
>
> Well, that's not entirely true. You ought to get a new one after
> Session.Abandon().
>
>
>
> --
> 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.
>



Jun 5 '06 #14
Thanks Anthony and Evertjan. All your comments make good sense and are
appreciated.

Martin
"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:ul**************@TK2MSFTNGP04.phx.gbl...

"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_uk> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Finally found the problem. I hadn't placed an expires=-1 on the pages.
Didn't think it was necessary. However, the site was being run through a
proxy server which, of course, was caching the page. Mental note to

oneself,
if using session variables, use expires=-1 as well!!


You are correct that Expires shouldn't be necessary since ASP doesn't
generate cacheable content.

So either your ASP is generating headers which makes the proxy server
think
the content is cacheable or
the proxy server is making 'intelligent' choices about whether to cache
what
strictly speaking it shouldn't.

For example if your ASP page generates the exact same content every time
for
a given request a proxy server might assume that it can safely cache the
response.

For belts and braces prevention of caching use:-

Response.Expires = -1440 ' 1 day old
Response.CacheControl = "private, no-cache, max-age=0" 'Only works with
HTTP/1.1 compliant proxies

Anthony
Thanks all, for your input.

Martin
"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_uk> wrote in message
news:em**************@TK2MSFTNGP05.phx.gbl...
> Thanks Mike. No I haven't but only as they use Session variables for
> various security checks etc and have therefore assumed (cough) that
> that
> side would be OK. I'll double check though.
>
> It may be that this is not really an ASP problem but an IIS problem and is > being visualised as a session variable issue.
>
> Martin
>
>
> "Mike Brind" <pa*******@hotmail.com> wrote in message
> news:11*********************@h76g2000cwa.googlegro ups.com...
>> Ermmmm.... this might be a silly question, but have you checked to see
>> if Enable Session State has been checked in the Application
>> configuration on your client's server?
>>
>> --
>> Mike Brind
>>
>> Martin Walke wrote:
>>> Thanks for the responses guys.
>>>
>>> OK.. maybe I'm confused about session variables. My site opens in a new >>> window from a link. I have a line
>>>
>>> <%
>>> ...
>>> session("qid") = 0
>>> ...
>>> %>
>>> that is on the first page of my site. This session variable is used
>>> to
>>> determine what information is to be shown on the next page. The next
>>> page
>>> increments this session variable and after user interaction, the page is >>> shown again (but with different info) based on the value of 'qid'.
>>>
>>> <%
>>> ...
>>> session("qid") = session("qid") + 1
>>> ...
>>> %>
>>>
>>> If the user then quits this site (but doesn't close all browser windows) >>> and
>>> then returns to the site, the session variable is not reset to 0 on the >>> first page.
>>>
>>> The real rub here is that it works on 3 other servers, plus PWS, but not >>> on
>>> the client's live server. What gives?
>>>
>>> Martin
>>>
>>> "Dave Anderson" <GT**********@spammotel.com> wrote in message
>>> news:u9**************@TK2MSFTNGP03.phx.gbl...
>>> > Bob Barrows [MVP] wrote:
>>> >> Unless you close all browser windows that were open when
>>> >> the session was begun, you will not get a new session.
>>> >
>>> > Well, that's not entirely true. You ought to get a new one after
>>> > Session.Abandon().
>>> >
>>> >
>>> >
>>> > --
>>> > 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.
>>> >
>>
>
>



Jun 9 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2359
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
6
656
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter,...
4
5573
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the...
31
6966
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
10
3477
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
3
2888
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
3
2663
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
18
3396
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
26
3575
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
12
3808
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.