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

Losing sessions. Sort of.

P: 1
Hi Folks

I have a custom CMS built in classic ASP that is losing session variables. To wit, I can create a situation where my 'show all the set SVs' test page shows a different set of SVs on each refresh of the browser.

My test page goes a little something like this:

Expand|Select|Wrap|Line Numbers
  1. <h1>Checking Session Variables</h1>
  2. <h2>Checking  what session variables are set.</h2>
  3. <p>
  4. <%
  5. dim k
  6. For Each k in Session.Contents
  7.   Response.Write(k & "<br />")
  8. Next
  9. %>
  10. </p>
  11. <h2>Checking the contents of the session variables.</h2>
  12. <p>
  13. <%
  14. dim i
  15. dim j
  16. j=Session.Contents.Count
  17. Response.Write("Session variables: " & j & "<br />")
  18. For i=1 to j
  19.   Response.Write(Session.Contents(i) & "<br />")
  20. Next
  21. %>
  22. </p>
  23.  
So. In Firefox I open three tabs, one with my test page, one with my login page, and one with a sample page within my application.

Before logging in, I test the page. There are about ten session variables that are set in the global.asa -- that's the way the app was handed off to me. If I don't log in, and run my test script, I get this:

[HTML]
10 Session Variables are set.

ApplicationQS =
ApplicationQSFormer =
QSCount = 0
PageId =
TopBannerImage = images/general.png
HexColor = reg-text.css
Footer = default.txt
IsRoot = True
ErrMsg =
FullPageUri = http://domain.tld/
[/HTML]

These are all intended for the front end of my CMS, but appear here. Okay...

I log in, and test the set SVs. I get:

[HTML]
4 Session Variables are set.

RoleId: 1
UserId: 37
UserName: jfriesen
LoggedIn: true[/HTML]

The previous SVs are gone; all we have right now are the login SVs. All good. So I go into my application and fiddle around.

Some bits of the application will call a function from functions.asp, which will run a database query from dataAccess.asp and return values to the function, which will then set some session variables and close the recordset call. The page will then use those session variables through the page. I've set the page to eliminate those temporary session variables at the end of the page. But usually it works with 8 SVs.

Sometimes when I work with that page, and go back and test what SVs are set, I see some of the login SVs, and some of the global.asa SVs, and a couple of the page ones.

But the real kicker is when it gets into a situation where the login SVs vanish. But if I refresh the page, they return. Refresh again, gone. Refresh again, they're back.

I'm tearing out my hair... ideas?

j
Aug 8 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.