Verify if Session(hashtable) exists

C

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 ...
 
A

addup

You can ennumerate the Session.Keys collection.
Unfortunately it does not provide a "contains" function

-- addup --
 
C

Carlos Albert

Visual doesn't allow my to use is null (or System.DBNull for the case)...
=(
 
C

Carlos Albert

Oh, I found the way:

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

Tnx everybody =)
 
P

Peter Rilling

Didn't release you were using VB.NET. C# has "null" and VB.NET has
"nothing".
 
A

addup

ah -- I must have misunderstood the question

for VB.NET

If HttpContext.Current.Session Is Nothing Then
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top