Illogical Session variable output

Results 1 to 2 of 2

Thread: Illogical Session variable output

  1. #1
    Join Date
    Dec 1969

    Default Illogical Session variable output

    Ok this little problem is driving me INSANE. I have been debugging it line by line but the result is still not the result I am expecting. Ok could someone explain this to me:<BR>-------------------------------------<BR><BR>What could be trigerring the wrong output below?<BR>Sub phew()<BR> Session("myCartMaxIndex") = 2<BR>End Sub<BR><BR>Call Phew()<BR>Response.Write Session("myCartMaxIndex") & "&#060;BR /&#062;"<BR>Session("myCartMaxIndex") = Session("myCartMaxIndex") - 1<BR>Response.Write Session("myCartMaxIndex")<BR><BR>--------------------<BR>output: <BR>2<BR>2<BR><BR>Seems the session assignment is affecting the previous response.write of the session somehow??? Any ideas at all where I might have a logical problem in my app that could trigger this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Illogical Session variable output

    I am thinking its because that session variable is only made available inside the sub<BR><BR>Try doing it all inside the sub like this<BR><BR>Sub phew()<BR>Session("myCartMaxIndex") = 2<BR>Response.Write Session("myCartMaxIndex") & "&#060;BR /&#062;"<BR>Session("myCartMaxIndex") = Session("myCartMaxIndex") - 1<BR>Response.Write Session("myCartMaxIndex")<BR>End Sub<BR><BR>Call Phew()<BR>And see what happens...<BR><BR>Maybe you can define the session variable "Outside the sub" first...<BR>then you should be able to change its values from inside and outside the sub...<BR><BR>something like that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts