473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Verify if Session(hashtable) exists

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 ...
Dec 9 '05 #1
8 2011
How about checking if the value is null?

"Carlos Albert" <nospam@noplace> wrote in message
news:%2****************@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 ...

Dec 9 '05 #2
You can ennumerate the Session.Keys collection.
Unfortunately it does not provide a "contains" function

-- addup --

Dec 9 '05 #3
Mhmm... and how could I just see if the session exists at all?

"addup" <ad*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
You can ennumerate the Session.Keys collection.
Unfortunately it does not provide a "contains" function

-- addup --

Dec 9 '05 #4
Visual doesn't allow my to use is null (or System.DBNull for the case)...
=(

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Os*************@TK2MSFTNGP12.phx.gbl...
How about checking if the value is null?

"Carlos Albert" <nospam@noplace> wrote in message
news:%2****************@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 ...


Dec 9 '05 #5
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:%2****************@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 ...

Dec 9 '05 #6
Didn't release you were using VB.NET. C# has "null" and VB.NET has
"nothing".

"Carlos Albert" <nospam@noplace> wrote in message
news:%2****************@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:%2****************@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 ...


Dec 9 '05 #7
LOL, my fault... thanks ^^

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Oo*************@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:%2****************@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:%2****************@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 ...



Dec 12 '05 #8
ah -- I must have misunderstood the question

for VB.NET

If HttpContext.Current.Session Is Nothing Then

Dec 14 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pavel Vetesnik | last post by:
Greetings! I have some troubles with session variables. I can easily create a session, but the variable I append to global session array ( $_SESSION) lasts only until the end of current...
1
by: yukist | last post by:
Hi all ! C# have a command like 'Session("abc") = 1' of Visual Basic.NET? TIA, yukist !
4
by: John Q. Smith | last post by:
I'm trying to find out some of the details behind OOP state management with SQL Server. For instance - how long does the session object live on any server? Is it created and destoyed with each...
0
by: Michael | last post by:
I have a problem here that only seems to happen on the one new server that we are migrating our ASP.Net application to. The server is a Windows 2000 SP4 box. It initially had the .Net Framework...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
2
by: Big Daddy | last post by:
I have an ASP.NET application where the user will be right in the middle of doing something and the sessions ends and then it blows up because I have stored some things in the Session hashtable. I...
6
by: Bhagya | last post by:
Hello, On the LogOut Page i have done Session.Abandon(); And on every Page, In the Page_Load Event i check if the session exists and only then display data. Now the problem is after i logout from...
2
by: Gordon Burditt | last post by:
I had this idea about preventing session fixation, and I'm wondering what anyone else thinks about it. The idea is, essentially, don't allow session ids that YOUR PHP didn't generate (and aren't...
1
by: HemantSa | last post by:
Session exists when i close browser in firefox...is there any way to remove the session if i open the new browser instance.... Regards, Hemant Sandbhor
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.