Session Problems

Results 1 to 2 of 2

Thread: Session Problems

  1. #1
    Join Date
    Dec 1969

    Default Session Problems

    Hi<BR><BR>I need help about Session variables :<BR>I have created a shopping cart using the Scripting.Dictionary object. I enclosed it in a Session variable, and everything works until the end of the check out, where (after it takes the Dictionary out of the Session variable to make the list of thing and proceed to payment) I have put an instruction to Set the Session variable to nothing, so as to clear the object. No error happends, but if I try to buy something more after that, or just to view the shopping cart (where there should not be anything), it returns an error saying that the dictionary object created (which should be the new one) is not valid. <BR><BR>I found the reason of this : the scripts finds something in the Session variable, and takes it as the shopping cart. Here is the instruction that makes this :<BR><BR>&#060;code&#062;<BR>&#060;%<BR>If isObject(Session("sCart")) Then &#039"sCart" is the session var<BR> Set dCart = Session("sCart") &#039dCart is the dict.<BR>Else<BR> Set dCart = Server.CreateObject("Scripting.Dictionary")<BR>End If<BR>%&#062;<BR>&#060;/code&#062;<BR><BR>So now, the question :<BR>Why does it "thinks" that the Session("sCart") variable contains an object whereas I just have cleared it ????<BR><BR>Thanks in advance for your help<BR><BR>CCM

  2. #2
    Join Date
    Dec 1969

    Default RE: Session Problems

    You don&#039t show enough code to really diagnose things, but how about this: Instead of using isObject, code it as:<BR><BR>&#060;%<BR>If TypeName( Session("sCart") ) = "Dictionary" Then<BR>&nbsp; &nbsp; Set dCart = Session("sCart")<BR>...<BR>%&#062;<BR><BR>If it&#039s really still a Dictionary, then you have deeper problems and need to show more code.<BR><BR><BR>

Posting Permissions

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