Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Help with Cookies


Message #1 by mariana@t... on Thu, 13 Sep 2001 13:19:30
Good Day All,



I am using a set of forms to collect a bunch of information from the user. 

As they go through the forms their choices are saved in a cookie which I 

kill at the end upon sending the values from the cookie in an email.  My 

problem is that when I go through cookie the values reading them into the 

email, they come out in no particular order.  How can I get them out in 

the same order they're put in?  I'm using the following code to get the 

name/value pairs in the cookie:



If Request.Cookies("DevForm").HasKeys Then

  For Each CookieKey in Request.Cookies("DevForm")

    strBody = strBody & CookieKey &	" = " &_

    Request.Cookies("DevForm")(CookieKey) & vbcrlf

  Next

Else

  strBody="No results returned."

End If



Thank you in advance.



Mariana
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 14 Sep 2001 16:01:03 +1000
Why can't you reference the keys in the order that you want?



AFAIK a collection is un-ordered - you access a collection by key, not by

ordinal position. If you want order, use an array.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <mariana@t...>

Subject: [asp_web_howto] Help with Cookies





: I am using a set of forms to collect a bunch of information from the user.

: As they go through the forms their choices are saved in a cookie which I

: kill at the end upon sending the values from the cookie in an email.  My

: problem is that when I go through cookie the values reading them into the

: email, they come out in no particular order.  How can I get them out in

: the same order they're put in?  I'm using the following code to get the

: name/value pairs in the cookie:

:

: If Request.Cookies("DevForm").HasKeys Then

:   For Each CookieKey in Request.Cookies("DevForm")

:     strBody = strBody & CookieKey & " = " &_

:     Request.Cookies("DevForm")(CookieKey) & vbcrlf

:   Next

: Else

:   strBody="No results returned."

: End If

:

: Thank you in advance.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index