Home All Groups Group Topic Archive Search About

Verify if Session(hashtable) exists

Author
9 Dec 2005 8:34 PM
Carlos Albert
Hello everybody,

I have SHOULD have a hashtable stored in a Session. How can I verify it such
session really exists? I tried to use these sentences but ASP.NET doesn't
like them, it says that session("hashtable") is not a string, or boolean...

if session("hashtable") then ...

if session("hashtable") <> "" then ...

Author
9 Dec 2005 8:54 PM
Peter Rilling
How about checking if the value is null?

Show quote
"Carlos Albert" <nospam@noplace> wrote in message
news:%23RaO3$P$FHA.3104@TK2MSFTNGP15.phx.gbl...
> Hello everybody,
>
> I have SHOULD have a hashtable stored in a Session. How can I verify it
> such session really exists? I tried to use these sentences but ASP.NET
> doesn't like them, it says that session("hashtable") is not a string, or
> boolean...
>
> if session("hashtable") then ...
>
> if session("hashtable") <> "" then ...
>
Author
9 Dec 2005 9:17 PM
addup
You can ennumerate the Session.Keys collection.
Unfortunately it does not provide a "contains" function

-- addup --
Author
9 Dec 2005 9:38 PM
Carlos Albert
Mhmm... and how could I just see if the session exists at all?

Show quote
"addup" <adi.***@gmail.com> wrote in message
news:1134163020.433093.314770@o13g2000cwo.googlegroups.com...
> You can ennumerate the Session.Keys collection.
> Unfortunately it does not provide a "contains" function
>
> -- addup --
>
Author
14 Dec 2005 8:13 PM
addup
ah -- I must have misunderstood the question

for VB.NET

If HttpContext.Current.Session Is Nothing Then
Author
9 Dec 2005 9:38 PM
Carlos Albert
Visual doesn't allow my to use is null (or System.DBNull for the case)...
=(

Show quote
"Peter Rilling" <peter@nospam.rilling.net> wrote in message
news:OspwyKQ$FHA.356@TK2MSFTNGP12.phx.gbl...
> How about checking if the value is null?
>
> "Carlos Albert" <nospam@noplace> wrote in message
> news:%23RaO3$P$FHA.3104@TK2MSFTNGP15.phx.gbl...
>> Hello everybody,
>>
>> I have SHOULD have a hashtable stored in a Session. How can I verify it
>> such session really exists? I tried to use these sentences but ASP.NET
>> doesn't like them, it says that session("hashtable") is not a string, or
>> boolean...
>>
>> if session("hashtable") then ...
>>
>> if session("hashtable") <> "" then ...
>>
>
>
Author
9 Dec 2005 9:44 PM
Carlos Albert
Oh, I found the way:

Dim xx as hashtable = session("hashtable")
if not xx is nothing then ...

Tnx everybody =)

Show quote
"Carlos Albert" <nospam@noplace> wrote in message
news:%23RaO3$P$FHA.3104@TK2MSFTNGP15.phx.gbl...
> Hello everybody,
>
> I have SHOULD have a hashtable stored in a Session. How can I verify it
> such session really exists? I tried to use these sentences but ASP.NET
> doesn't like them, it says that session("hashtable") is not a string, or
> boolean...
>
> if session("hashtable") then ...
>
> if session("hashtable") <> "" then ...
>
Author
9 Dec 2005 9:52 PM
Peter Rilling
Didn't release you were using VB.NET.  C# has "null" and VB.NET has
"nothing".

Show quote
"Carlos Albert" <nospam@noplace> wrote in message
news:%231p34mQ$FHA.2812@TK2MSFTNGP09.phx.gbl...
> Oh, I found the way:
>
> Dim xx as hashtable = session("hashtable")
> if not xx is nothing then ...
>
> Tnx everybody =)
>
> "Carlos Albert" <nospam@noplace> wrote in message
> news:%23RaO3$P$FHA.3104@TK2MSFTNGP15.phx.gbl...
>> Hello everybody,
>>
>> I have SHOULD have a hashtable stored in a Session. How can I verify it
>> such session really exists? I tried to use these sentences but ASP.NET
>> doesn't like them, it says that session("hashtable") is not a string, or
>> boolean...
>>
>> if session("hashtable") then ...
>>
>> if session("hashtable") <> "" then ...
>>
>
>
Author
12 Dec 2005 8:40 PM
Carlos Albert
LOL, my fault... thanks ^^

Show quote
"Peter Rilling" <peter@nospam.rilling.net> wrote in message
news:OoPyqrQ$FHA.360@TK2MSFTNGP09.phx.gbl...
> Didn't release you were using VB.NET.  C# has "null" and VB.NET has
> "nothing".
>
> "Carlos Albert" <nospam@noplace> wrote in message
> news:%231p34mQ$FHA.2812@TK2MSFTNGP09.phx.gbl...
>> Oh, I found the way:
>>
>> Dim xx as hashtable = session("hashtable")
>> if not xx is nothing then ...
>>
>> Tnx everybody =)
>>
>> "Carlos Albert" <nospam@noplace> wrote in message
>> news:%23RaO3$P$FHA.3104@TK2MSFTNGP15.phx.gbl...
>>> Hello everybody,
>>>
>>> I have SHOULD have a hashtable stored in a Session. How can I verify it
>>> such session really exists? I tried to use these sentences but ASP.NET
>>> doesn't like them, it says that session("hashtable") is not a string, or
>>> boolean...
>>>
>>> if session("hashtable") then ...
>>>
>>> if session("hashtable") <> "" then ...
>>>
>>
>>
>
>

AddThis Social Bookmark Button