Session timeout problem...

From: Spooki71 (Spooki71_at_discussions.microsoft.com)
Date: 01/12/05


Date: Wed, 12 Jan 2005 06:43:04 -0800

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



Relevant Pages

  • Cannot open database requested in login ASPState. Login fails. Login failed for user sa.
    ... Visual Studio app, I got round to the option for storing the state in SQL ... sessionState statement (so the app runs with the default in-proc session ... What is causing the login failure? ... Cannot open database requested in login 'ASPState'. ...
    (microsoft.public.sqlserver.security)
  • new session created when changing pages
    ... I have a set of pages with C# code attached to manage session information. ... They hang their info off of the session string and store it in a MSDE table. ... I have all of this code working well in one app and started another app which ... find that I am get redirected every time I login back to my login because ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session State across ASP.NET apps
    ... we are already using a central state server for all web ... so I knew about the encrypt decrypt thing for that. ... I'm just talking about sharing the session between apps. ... You can then grab the vars in the other app. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ASP.NET Application - Defined???
    ... > gateway to the app). ... > business object into session state. ... > - Then Main.aspx did the bus obj user validation and filled out the rest ...
    (microsoft.public.dotnet.framework.aspnet)
  • Session object timout
    ... must go through a login page. ... Upon logging in I set some properties in a ... to a session object which I named "CurrentUserInfo". ... Since the app relies on retrieving only information for the company of which ...
    (microsoft.public.dotnet.framework.aspnet)