Print Page | Close Window

Losing session state in ASP

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=30827
Printed Date: 30 March 2026 at 12:09pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Losing session state in ASP
Posted By: oap2
Subject: Losing session state in ASP
Date Posted: 20 August 2013 at 5:53pm
Hello.
 
I am running Web Wiz forums under ASP with my own existing user database (not Webwizforums new user registration).

So say a user named "BillA" logs into my site, upon his first visit to WebWizforums an account will be created for him automatically with the same username. This WebWizforum (WWF) feature is described here:
http://www.webwiz.net/web-wiz-forums/kb/existing-members-api.htm - http://www.webwiz.net/web-wiz-forums/kb/existing-members-api.htm
 
Here is the code I use to login to the forums:
 
mypass = objrs("password")
myemail = objrs("email")
(username is defined already)

Session("USER") = Username
Session("PASSWORD") = mypass
Session("EMAIL") = myemail
response.redirect("default.asp")

The first two lines of code get the password and email address of the user from the SQL database. Session variables are set (as per WWF documentation) and the user is redirected to the default page of WWF.
 
The problem is that randomly access is lost. I have only 3 levels of access for the forum: basic, advanced and administrator. Sometimes advanced as well as administrator accounts default to basic access levels. That is, you can only see and access the first access level forums. I can't even login to the Admin features as the Admin menu disappears (obviously).
 
The only remedy for users and myself is to logout of my site, close the browser and log back in and try the forums again.
 
What is going on here?

edit: I just tried my forum now and initially it let me in with admin access (all forums visible) but when I clicked on a single forum it gave me an error message about not having access. The [login] box then appears at the top of the forum page leading me to believe that it isn't so much a loss of access but it's not maintaining the login state. Even if I go back to the forum via the same page that sets the session variables, it fails.


 



Replies:
Posted By: WebWiz-Bruce
Date Posted: 21 August 2013 at 10:00am
This method of using an existing database uses session variables. Session variables are dropped if the application pool for your website recycles at which point you would likely be logged out.

You should change the application pool for your website so that it only recycles once a day at a quite time like 4am so that it does not affect the login state of your forum to much.



-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: oap2
Date Posted: 21 August 2013 at 12:31pm
Thanks for reply.
 
This is occuring multiple times a day often within 2-3 minutes apart. I don't think it's anything to do with session variables not to mention that when I go back to the forum via my "autologin.asp" page it sets the session variables. So recycled or not they should be brought back to life and allow me into the forum.
 
I could write a test script and put it in the forum to display the session vars, just to eliminate the possibility it is a session issue - but I'm 99% certain it's not.


Posted By: WebWiz-Bruce
Date Posted: 21 August 2013 at 5:41pm
I have moved this to the Web Wiz Forums support forums as this is not an issue with our hosting services.

The issue you have still sounds very much like a session issue related to how you have your website and application pool configured.

If you use multiple application pools, or they are configured to recycle under load then you can see sessions dropped within 2 or 3 minutes.

You should make sure that the website you login from and Web Wiz Forums both run in the same website that has a single application pool configured to recycle just once a day at 4am in the morning. 

You should also check your Windows logs for WAS events to see if application pools are recycling prematurely due to load on the server.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: oap2
Date Posted: 05 September 2013 at 5:59am

Thanks for the reply.

As I've mentioned though, when I go to click on the forum link it sets the session variables that instant and redirects to the forum default.asp page. The sessions would not be lost. Just to test this, I added some code to the default.asp page to display my session variables.
 
They displayed my username, password and email. I kept visiting various pages on my site and returning to the forum. Eventually it defaulted back to the public forums and not the second access level forums while the session variables were still intact.
 
For some reason the forum is losing the logged in user and it's NOT the session variables.

I have just changed the "Store Session Data in Database" option to yes and we'll see if it helps.
 
Another bug... while logged in, I may attempt to login to Admin controls by clicking on the Admin option. When I enter my password it says it is incorrect (yet it is not). I close the browser and try again and then it works.
 


Posted By: WebWiz-Bruce
Date Posted: 05 September 2013 at 5:19pm
You had not mentioned that you had disabled the "Store Session Data in Database" option.

This should always be disabled, and is probably the cause of the issues that you reported.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: oap2
Date Posted: 05 September 2013 at 8:24pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

You had not mentioned that you had disabled the "Store Session Data in Database" option.

This should always be disabled, and is probably the cause of the issues that you reported.

It was always disabled until last night. It seemed to work for a while but today it's back to losing the user data. If I go to the forum, higher level access forums are not there and the basic access ones don't let me post because I'm not logged in.
 
 


Posted By: WebWiz-Bruce
Date Posted: 06 September 2013 at 9:00am
If you have support you should open a Support Ticket from your Client Area account at the link below and include Forum Admin login details and as much detail as possible.

http://www.webwiz.net/clientarea/support-portal.htm" rel="nofollow - https://www.webwiz.net/clientarea/support-portal.htm


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net