Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Losing session state in ASP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Losing session state in ASP

 Post Reply Post Reply
Author
oap2 View Drop Down
Newbie
Newbie


Joined: 20 August 2013
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote oap2 Quote  Post ReplyReply Direct Link To This Post Topic: Losing session state in ASP
    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.


 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
oap2 View Drop Down
Newbie
Newbie


Joined: 20 August 2013
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote oap2 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
oap2 View Drop Down
Newbie
Newbie


Joined: 20 August 2013
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote oap2 Quote  Post ReplyReply Direct Link To This Post 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.
 


Edited by oap2 - 05 September 2013 at 6:13am
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
oap2 View Drop Down
Newbie
Newbie


Joined: 20 August 2013
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote oap2 Quote  Post ReplyReply Direct Link To This Post 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.
 
 


Edited by oap2 - 06 September 2013 at 2:36am
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.

https://www.webwiz.net/clientarea/support-portal.htm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.