Store Dictionary Object in Session not working
am 15.02.2007 17:18:31 von 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
Re: Store Dictionary Object in Session not working
am 15.02.2007 17:51:25 von reb01501
J055 wrote:
> 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.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.