473,378 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

session

Hi,

Could somebody please tell me how I check whether a session is dead based
soley on the Session.SessionID.
At present the timeout is set to 20 minutes in IIS, I am aware that I can
reset this on the page. However after 22 minutes, or some interval longer
than the session timeout, the Session.SessionID values is still availible.

What I want to achieve is this. There is a small section of my site that
must have an active session. When a user enteres this part of the site I
must check if the session is still active because I am going to want to
create variable in the sesion object. If the session is dead, I have to
figure out how I am going to handle this,
Can anybody suggest how to do this?? I am thinking I could either bring the
session back to life, is this possible?? or use some sort of client side
script to open a new window.

cheers

martin.
Jul 19 '05 #1
4 5001
"David B" <da*******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

Could somebody please tell me how I check whether a session is dead based soley on the Session.SessionID.
At present the timeout is set to 20 minutes in IIS, I am aware that I can
reset this on the page. However after 22 minutes, or some interval longer
than the session timeout, the Session.SessionID values is still availible.
A new ID will be created.

What I want to achieve is this. There is a small section of my site that
must have an active session.
The user will have an active session if he hits your site, even if that
section is the first place he goes.
When a user enteres this part of the site I
must check if the session is still active because I am going to want to
create variable in the sesion object. If the session is dead, I have to
figure out how I am going to handle this,
Can anybody suggest how to do this?? I am thinking I could either bring the session back to life, is this possible??


It happens on its own by the user hitting the server.

What is it that you really want to do? What is it that makes you need what
you describe?

Ray at home
Jul 19 '05 #2
Ray, Cheers for the (exceptionally quick) reply,

This is the senariono, A user goes to my site and initially we are not
concernecd with sessions.
They then go onto a booking section. This booking section stores all
information in a database.
When a user starts a booking a new record is stored in the database with a
PK (integer) this PK is stored in a session variable (session("ID") so that
the user on the site can always connect to their required records in the
database.
However if the session expires then session("ID") is not availible.

At this point I want to tell the user that their session has expired.

However, the following code ALWAYS tells me the Session("ID") is numeric,
even if it does not exist.

if ISNUMERIC(Session("ID")) then
Response.Write("Session('ID') is numeric -- it is Alive -- session ID is
")
else
Response.Write("Session('ID') is not numeric -- it is dead") end if

I guess what I am asking in a nutshell is how I tell if the sesion has
expired.

Or maybe ISNUMERIC has a bug, returning true when the Session("ID") is
clearly empty ...:)

There are two different senarios for checking if the session has expired.

1. The user has not been assigned a session("ID") yet --- This seems to be
the most difficult case,

2. They are midway through the process, they have already been assigned a
session ID but the session has expired.

cheers

martin.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:uu**************@TK2MSFTNGP12.phx.gbl...
"David B" <da*******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

Could somebody please tell me how I check whether a session is dead based
soley on the Session.SessionID.
At present the timeout is set to 20 minutes in IIS, I am aware that I can reset this on the page. However after 22 minutes, or some interval longer than the session timeout, the Session.SessionID values is still

availible.
A new ID will be created.

What I want to achieve is this. There is a small section of my site that
must have an active session.
The user will have an active session if he hits your site, even if that
section is the first place he goes.
When a user enteres this part of the site I
must check if the session is still active because I am going to want to
create variable in the sesion object. If the session is dead, I have to
figure out how I am going to handle this,
Can anybody suggest how to do this?? I am thinking I could either bring

the
session back to life, is this possible??


It happens on its own by the user hitting the server.

What is it that you really want to do? What is it that makes you need

what you describe?

Ray at home

Jul 19 '05 #3
In article <#D**************@TK2MSFTNGP10.phx.gbl>, da*******@yahoo.com
says...
Could somebody please tell me how I check whether a session is dead based
soley on the Session.SessionID.
I don't think that changes until the browser closes.
What I want to achieve is this. There is a small section of my site that
must have an active session. When a user enteres this part of the site I
must check if the session is still active because I am going to want to
create variable in the sesion object.
I test a session variable that I know should be available:

If session("userId") = "" Then
figure out what to do
End If
If the session is dead, I have to figure out how I am going to
handle this...


I have the luxury of requiring my users to use IE6, so I use cookies. I
even have a class that figures out for itself if it needs to reload from
the cookies. Here's a short example:

Private Sub Class_Initialize( )

If session("FirstName") = "" Then
'Session must have expired - reload from the cookies
session("FirstName") = Request.Cookies ("User")("FName")
...
session("Rank") = Request.Cookies ("User")("UserRank")
End If

m_firstName = session("FirstName")
...
m_userRank = session("Rank")

End Sub
-- Rick
Jul 19 '05 #4
Thank you all for the input.

I am now a lot clearer on when and how a session expires.

cheers

dave.
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. .
In article <#D**************@TK2MSFTNGP10.phx.gbl>, da*******@yahoo.com
says...
Could somebody please tell me how I check whether a session is dead based soley on the Session.SessionID.


I don't think that changes until the browser closes.
What I want to achieve is this. There is a small section of my site that
must have an active session. When a user enteres this part of the site I
must check if the session is still active because I am going to want to
create variable in the sesion object.


I test a session variable that I know should be available:

If session("userId") = "" Then
figure out what to do
End If
If the session is dead, I have to figure out how I am going to
handle this...


I have the luxury of requiring my users to use IE6, so I use cookies. I
even have a class that figures out for itself if it needs to reload from
the cookies. Here's a short example:

Private Sub Class_Initialize( )

If session("FirstName") = "" Then
'Session must have expired - reload from the cookies
session("FirstName") = Request.Cookies ("User")("FName")
...
session("Rank") = Request.Cookies ("User")("UserRank")
End If

m_firstName = session("FirstName")
...
m_userRank = session("Rank")

End Sub
-- Rick

Jul 19 '05 #5

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

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
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...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.