473,382 Members | 1,512 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,382 software developers and data experts.

How to check if cookie not exist?

How do I check to see if a cookie exists or not?

I tried these 3 but they don't work...

If Not Request.Cookies("UserSettings")("IsAdmin") Is Nothing Then...
If Request.Cookies("UserSettings")("IsAdmin") IsNot Nothing Then...
If Not IsNothing(Request.Cookies("UserSettings")("IsAdmin ")) Then...

They all give me a System.NullReferenceException.

Thanks!
Mar 12 '08 #1
1 8886
If Not Request.Cookies("UserSettings") Is Nothing Then
If Not Request.Cookies("UserSettings")("IsAdmin") Is Nothing Then
...
end if
end if
-- bruce (sqlwork.com)
"Bobby Edward" wrote:
How do I check to see if a cookie exists or not?

I tried these 3 but they don't work...

If Not Request.Cookies("UserSettings")("IsAdmin") Is Nothing Then...
If Request.Cookies("UserSettings")("IsAdmin") IsNot Nothing Then...
If Not IsNothing(Request.Cookies("UserSettings")("IsAdmin ")) Then...

They all give me a System.NullReferenceException.

Thanks!
Mar 12 '08 #2

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

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
3
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change...
4
by: Christopher Nelson | last post by:
I have a multi-page site that I want to be able to resume at the same page if the user leaves and comes back later (say, days later). I'm thinking that I'll set a cookie as each page is displayed...
0
by: Tim T | last post by:
Hi, I have a web application that has a number of users who administer their own data... i have several pages that check to see if a valid userID session exists, and if not, send them to a...
1
by: hecsan07 | last post by:
I am trying to perform site login using values from a cookie, but for some weird reason the cookie is being destroyed after the browser window is closed. I checked the browser settings for the...
1
by: William | last post by:
ERROR: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. This if then statement only works if a cookie exists. It fails if the cookie...
4
by: Joe | last post by:
Hi, I have a asp.net page that checks if any one of the two cookies exists. If none of the cookies exist then redirect the user to login page. Cookie “try” doesn’t exists. I can see that...
2
by: Alan Silver | last post by:
Hello, I have discovered that if I try and add a cookie when one by that already exists, nothing happens. No error, but the cookie is not set to the new value. For example (this is running in...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
6
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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...

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.