By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,301 Members | 3,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,301 IT Pros & Developers. It's quick & easy.

Session timeout problem...

P: n/a
Hi, running .net v1.1 framework win2000 iis5.

I've got this random problem that is just driving me crazy and I'm hoping
somebody can help. So here goes:

I have a .net app that has a login page to authenticate users from a sql
database. When the user logs in successfully certain date is then stored in
session variables i.e Username=Session("Username") etc.
My web.config file is configured as followed:
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="datasource=127.0.0.1;Trusted_ Connection=yes"
cookieless="false"
timeout="20"
The IIS server has also a timeout setting of 20mins.
During the login, in code behind I have dynamically created a public shared
datatable that stores values like username,company,IP Address,Time of login
etc. I also created a page where I can view this shared datatable to see who
is currently logged into my system. All of this works fine with no problems.
When the user clicks logout menu option from my app I also have code behind
that will remove the revelvant row from the datatable. Thus giveing me an
accurate datagrid of all my logged in users. This works fine too.
Now the problem bit. If a user simply closes the window or surfs to another
site without logging out of my app, obviously at the 20min mark the users
session will time out. So I also included some code in the global.ascx page
in the session end sub to also remove the relevant row from my datatable, but
for some reason it only works about 60% of the time and I get an 'object not
set to an instance of an object' exception informing me that the session data
has gone.
My immediate thought was that the app was restarting for some reason. But I
ran some test code in the application start sub in global.ascx to log each
time it was restarted and nothing(apart from the first load of course).
I also read some where that the session mode InProc was unreliable, is this
true?
Anyway, I have to use InProc as I want to run code in the session end sub.

Anybody who has any suggestions/Ideas will be a great help as I'm totaly
scratching my head on this one.

Many Thanks
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.