Asp.net 3.5 VB Forms Authentication Login and session variables problem
Posted on 2011-04-26
I have an asp.net 3.5 Visual Basic forms authentication application where I use a login form to query a SQL Server 2005 Database.
If the login parameters are accepted, I create several session variables in the login code behind after querying the database…
Session("UserID") = (customReader("IDNum"))
Session("UserFName") = (customReader("FName"))
Session("UserLName") = (customReader("LName"))
Session("UserEmail") = (customReader("Email"))
And then proceed to open the session on the default page …
The bizzar occurance is that on no set time or action from any user, all of a sudden the Default Page which has 2 gridviews that rely on the Session("UserID") to populate themselves return 0 records, even though they just had records in them. What is really odd is the login authentication is still active and the login control on the default page is still showing the Session("UserID").
When the user loggs out and then back again things are back to normal but the same scenario can reoccur at any time.
The web.config is set the forms authentication mode and I have the timeout set to several hours.
Am I doing something wrong loading the session variables?
Why does the site function perfectly and then all of a sudden, the records in the Gridviews disappear and the authentication is still good?
I hope someone can help with this as this is really causing some problems