Store Dictionary Object in Session not working

J

J055

HI

Can someone tell me what is wrong with this? The first 'if' condition works
but the 'else' condition seems to get the right Count but the contents of
the key and items are lost.


Set dic_qs = CreateObject("Scripting.Dictionary")

If Request.QueryString("new") = "1" Then
Set Session("search_qs") = Request.QueryString()
Set dic_qs = Session("search_qs")
Else
If TypeName(Session("search_qs")) = "IRequestDictionary" Then
Set dic_qs = Session("search_qs")

Response.Write dic_qs.count

End If
End If


Many thanks
Andrew
 
B

Bob Barrows [MVP]

J055 said:
HI

Can someone tell me what is wrong with this? The first 'if' condition
works but the 'else' condition seems to get the right Count but the
contents of the key and items are lost.


Set dic_qs = CreateObject("Scripting.Dictionary")

If Request.QueryString("new") = "1" Then
Set Session("search_qs") = Request.QueryString()
Set dic_qs = Session("search_qs")
Else
If TypeName(Session("search_qs")) = "IRequestDictionary" Then
Set dic_qs = Session("search_qs")

Response.Write dic_qs.count

End If
End If

It's a good thing you can't get it to work. Storing a Dictionary object
in Session or Application is one of the best ways to kill web
application performance and is definitely not recommended. You need to
come up with another strategy, perhaps a free-threaded xml document.
 
J

J055

Hi Bob

That's quite sad. An alternative method is quite a bit more work.

Oh well
Thanks anyway

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top