Hi there,
I ran into this issue a long time ago as well. Here's how I fixed it.
In classic ASP, set cookies like this:
Code:
Response.Cookies("MYNetCookie") = ConvertCharsToEntities ("YourValue")
Function ConvertCharsToEntities(s)
Dim i, c
For i = 0 To (len(s) -1)
If i > 0 Then
c = c & "-"
End If
c = c & (Asc(Mid(s, i+1, 1)))
Next
ConvertCharsToEntities = c
End Function
Then in .NET you can get the cookies value like this:
Code:
MyCookieString = UrlDecode(Request.Cookies("MYNetCookie").Value.ToString())
Code:
' Split to array with all asc codes
arrMyValue = Split(MyCookieString, "-")
Dim i As Integer = 0
For i = 0 To ((arrMyValue.Length) - 1)
MyCookieValue &= Chr(arrMyValue(i))
Next
' At this point, MyCookieValue should contain the initial string
Basically what this does is convert each character in your original string to its associated numeric value. Then this long string of numbers (separated by a dash) is stored as the cookie's value.
In .NET the reversed process takes place: The cookie value is split on the dash, and each number is used to retrieve its associated string value to return the original string.
I can't really recall what the problem was, but I can imagine it has something to do with the way the cookie is sent as plain text or unicode. With "normal", low ascii values there is usually not a problem, but encrypted strings often contain a lot of weird characters.
This code is over 3 years old, so it may fix a problem that no longer exists in .NET 1.1 or 1.0 with a service pack. But it's worth a try.....
Hope this helps, and if it does, can you let me know?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Hyper chondriac music by
Muse (Track 10 from the album:
Hullabaloo)
What's This?