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
- <h1>Checking Session Variables</h1>
- <h2>Checking what session variables are set.</h2>
- <p>
- <%
- dim k
- For Each k in Session.Contents
- Response.Write(k & "<br />")
- Next
- %>
- </p>
- <h2>Checking the contents of the session variables.</h2>
- <p>
- <%
- dim i
- dim j
- j=Session.Contents.Count
- Response.Write("Session variables: " & j & "<br />")
- For i=1 to j
- Response.Write(Session.Contents(i) & "<br />")
- Next
- %>
- </p>
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 =
ApplicationQSFo rmer =
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