Last post Feb 12, 2009 09:05 PM by Rick Matthys
Feb 12, 2009 05:41 PM|ninjaninja|LINK
I have several sessions stored at one time, and i want to count a particular one:
i have session.contents("session1") and session.contents("session2")
but i only want to check if there is anything in session2...
I tried this:
If Session.Contents("session2") = "" Then
as in, if theres nothing in it, then do something. But... it says when there is nothing in session2, that theres no object reference, i want to do something like this:
session.contents("session2").count or something, can anyone help?
Feb 12, 2009 09:05 PM|Rick Matthys|LINK
Just so we're on the same page... you only have one session, you're storing multiple objects in the session. To see if a key has already has a value, you need to
check if it is null, not an empty string. Also, you might find it more readable to use array syntax. i.e.
if (Sesson["somekey"] == null) instead of Session.Contents("somekey")...