|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Verify if Session(hashtable) existsHello 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 ... 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 ... > You can ennumerate the Session.Keys collection.
Unfortunately it does not provide a "contains" function -- addup -- 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 -- > ah -- I must have misunderstood the question
for VB.NET If HttpContext.Current.Session Is Nothing Then 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 ... >> > > 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 ... > 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 ... >> > > 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 ... >>> >> >> > > |
|||||||||||||||||||||||