Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to check if cookie not exist?

Reply
Thread Tools

How to check if cookie not exist?

 
 
Bobby Edward
Guest
Posts: n/a
 
      03-12-2008
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!


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-12-2008
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!
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Simple Cookie Script: Not recognising Cookie Jimbo Python 1 04-08-2010 07:34 AM
how to check cookie enabled for the browser or not? BL ASP .Net 3 09-08-2008 05:29 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Session cookie? Browser instance cookie? Ben ASP .Net 3 06-03-2004 03:41 AM



Advertisments