Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Something I am doing with Session seems funky

Reply
Thread Tools

Something I am doing with Session seems funky

 
 
Stephanie Stowe
Guest
Posts: n/a
 
      04-07-2004
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


 
Reply With Quote
 
 
 
 
Stephanie Stowe
Guest
Posts: n/a
 
      04-07-2004
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
"Stephanie Stowe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
something funky Johnfli ASP General 9 05-03-2006 04:07 PM
Funky P-t-P T1, SBC says I have a timing problem, I say BS... Doug Cisco 4 07-25-2004 02:14 AM
Address Book is Funky Peter Arnold Firefox 1 07-13-2004 12:57 PM
DNS funky when using Cisco IOS w/ IPFW Brian Bergin Cisco 0 02-02-2004 01:06 PM
Funky error Situation Diogenes Dilone ASP .Net 3 01-07-2004 04:12 PM



Advertisments