How to check if cookie not exist?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Edward

    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(Reque st.Cookies("Use rSettings")("Is Admin")) Then...

    They all give me a System.NullRefe renceException.

    Thanks!


  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: How to check if cookie not exist?

    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(Reque st.Cookies("Use rSettings")("Is Admin")) Then...
    >
    They all give me a System.NullRefe renceException.
    >
    Thanks!
    >
    >
    >

    Comment

    Working...