Contents of Dictionary Object

Results 1 to 4 of 4

Thread: Contents of Dictionary Object

  1. #1
    Join Date
    Dec 1969

    Default Contents of Dictionary Object

    I&#039;m using a Dictionary object to retain the contents of a user&#039;s shopping cart as found on I assign the dictionary object to a session variable like this <BR><BR>Set Session("cart") = dictCart<BR><BR>How do I iterate through the contents of Session("cart") on another page in my application and display the contents to the user? Thanks.

  2. #2
    Join Date
    Dec 1969

    Default Dictionary not thread-safe

    You shouldn&#039;t store the dictionary object at the session scope... you&#039;ll bog down after only a few users due to thread affinity.<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default BAD idea.

    Ok, assigning an object - ANY object - to a session variable is an exceptionally bad idea. It means that IIS cannot correctly use threading, and will induce a massive overhead on your application.<BR><BR>You should store the contents as a STRING and then parse the information out (into a dictionary object, if neccessary), when you need to.<BR><BR>When you DO need to, you can do something like:<BR><BR>&#060;%<BR>For intCounter = 0 to dictCart.Count<BR> Response.Write(dictCart(intCounter))<BR> ...<BR>Next<BR>%&#062;<BR><BR>Craig.

  4. #4

    Default Sessions and dictionaries

    Sessions were fine a couple years ago, but with current traffic expectations they are suitable.<BR>If you know the exact maximum number of users, you might determine that only one web server will be needed and thus that sessions are ok. Even so, you should abstract your use of persistent user information (sessions) so that when your app has to scale, you can change only a couple of functions, to use cookies or a db instead.<BR><BR>The scripting.dictionary should not be used at session or application scope( or any other apartment threaded object), the reasons are given in the ASP best practice documents. An expample of how to get unexpected (errored) results is also there in a KB art.<BR><BR>The Commerce.Dictionary is entirely appropriate for Application scope.<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