473,545 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

session

Hi,

Could somebody please tell me how I check whether a session is dead based
soley on the Session.Session ID.
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.Session ID 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 5015
"David B" <da*******@yaho o.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

Could somebody please tell me how I check whether a session is dead based soley on the Session.Session ID.
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.Session ID 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(Sessi on("ID")) then
Response.Write( "Session('I D') is numeric -- it is Alive -- session ID is
")
else
Response.Write( "Session('I D') 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******** ******@TK2MSFTN GP12.phx.gbl...
"David B" <da*******@yaho o.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

Could somebody please tell me how I check whether a session is dead based
soley on the Session.Session ID.
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.Session ID 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.Session ID.
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_Initializ e( )

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

m_firstName = session("FirstN ame")
...
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.c om> 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.Session ID.


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_Initializ e( )

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

m_firstName = session("FirstN ame")
...
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
3295
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 and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and...
1
4362
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 log in each time they come to the site. In a .htaccess file I set session.cookie_lifetime to 20736000 seconds and I set session.gc_maxlifetime to...
6
2372
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 email from (possibly) three seperate forms. the following code is the end of a routine which stashes data from the first form off to session...
5
2439
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 variables and all of them are being stored into session and accessed from session and individual session object. Example: Session = "XYZ", Session=100,...
0
3209
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 documentation it seems it should do it anyway any advice?
14
2351
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 User B has access to 5, now when both of us hits to the server at the same time then their session variables gets mixedup means either User A and...
7
3958
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 got the exact same SessionID as of other users's. Well I guess nothing wrong with my code, do I need to set any property in Web.Config file??
0
2460
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 the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of...
1
2575
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 name of that file from attaching file page to email page through in session file .i am giving a facility of attaching five files to user . and i...
5
2424
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
7502
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7434
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7946
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7791
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...

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.