Something I am doing with Session seems funky

  • Thread starter Stephanie Stowe
  • Start date
S

Stephanie Stowe

I am reading some data from a database and placing the values into session
variables. See code:

dim lngSessionID, pStr

pStr = "private, no-cache, must-revalidate"
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", pStr



' Get the return cookie. If the return cookie is set, then coming BACK.
If Request.Cookies("JSPAccessed") = "Yes" then <-- This is evaluated as
true. (I did not include the other subs as they are not executed and not
part of the problem.
DoReturn
else
WriteSessionInfo
WriteIdentifierCookie
end if



Sub DoReturn


dim strSQL, rs, strSessionID, strLoadPage, sessitem


strSessionID = Request.Cookies("MyID")


Response.Cookies("JSPAccess").Expires = #2000-01-01#


' Get the service to return to.
strSQL = "select M.ASPSessionID, S.LoadPage FROM Stowe.SessionMgr As M
INNER JOIN Stowe.SessionSources As S ON M.SourceService = S.SourceName " & _
"WHERE M.SessionID = " & strsessionid

set rs = cn.execute(strSQL)
strLoadPage = "../" & trim(rs("LoadPage").value)


if rs("ASPSessionID").value <> session.SessionID then
Session.abandon ' "delete" stuff which was initialized in Session_OnStart
strsql = "Select * FROM Stowe.SessionDetail Where SessionID=" &
strSessionID
set rs = cn.execute(strSQL)
do while not rs.eof


Session(rs("VarName").value) = rs("VarValue").value
rs.movenext
loop


for each sessitem in Session.Contents
Response.Write sessitem & " - " & session.Contents(sessitem) & "<BR>"
next
Response.End


end if


rs.close
set rs = nothing




Response.Redirect strLoadPage

End Sub



---------------------------------

In this segment,

for each sessitem in Session.Contents
Response.Write sessitem & " - " & session.Contents(sessitem) & "<BR>"
next
Response.End

I am writing the contents of the session for testing so I can see what is in
it. I am seeing each item twice with different values. I am trying to
understand why. I see:

AUTH - True
ROLE - Borr
SchoolID - 0
SchoolName -
Attempts - 1
UserID - 0
EFC_Year - 2001
EFCTest - False
PersonID - xxx
SSN - xxx
UserType - N
AUTH - True
ROLE - Borr
SchoolID - 0
SchoolName -
Attempts - 1
UserID - 0
EFC_Year - 2001
EFCTest - False
PersonID - xxx
SSN - xxx
UserType - N


Why am I seeing the set of session vars writing to the browser twice? I can
see in the database from whcih the values are retrieved that there are 11
and they match a single set from AUTH through UserType.

I would like to understand this so I am not messing up my session.

Please note that there is not a single other response.write in the rest of
the code. For what that is worth...

Thanks

S
 
S

Stephanie Stowe

Never thee mind.... I figured it out. I had a session.abandon. DOH. After
the Session.Abandon, Session_OnStart was firing. Geeesh.

Sorry to waste time.

S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top