Cache variable suddenly = null

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Cache variable suddenly = null

    I have a web application that inserts several enumerated lists into the Cache
    on the Initialize event of global.asax:

    Cache _cache = Context.Cache;
    _cache.Insert("Countries", htCountries);

    Sometime last night, the cached variable htCountries started to return a
    null value, causing our code to crash. Nothing in the code assigns this
    variable to null. Restarting the applicaton fixed the problem. (This
    particular code has been around for 3 months, and this error has never
    occurred before.)

    Is there a know security exploit of the .NET Cache object that would allow a
    hacker to do this?
    bayam Guest

  2. Similar Questions and Discussions

    1. NULL NULL Error
      I have run out of things to check for and could use some help. We are on a unix box, CFMX 7, and have started to use the CFDOCUMENT tag. The tag...
    2. Java variable NULL values
      Hi In my Java value object, some times String variables are coming NULL. That time, in CFM, it's giving undefined error. Please tell me how to...
    3. data variable = zero or null, then print "n/a"
      since my cfm application will be a constant source of periodically updated information, some of which will be temporarily incomplete records, when...
    4. Mac suddenly won't network through my PC
      Howdy all. Since getting my Powerbook last year, I've been successfully using the Internet Connection Sharing feature of Windows XP to network my...
    5. Error: ?null? is null or not an object
      eloine: That is a bogus error message in that it probably refers to something you have done (or not done) on the page. So, looking in the...
  3. #2

    Default Re: Cache variable suddenly = null

    Any items stored in the cache are "volatile" and can be removed by the
    system. Using the insert method you describe below, inserts the cached item
    with a default priority. The default being "Normal". The MSDN docs explain
    this as.

    "Cache items with this priority level are likely to be deleted from the
    cache as the server frees system memory only after those items with Low or
    BelowNormal priority. This is the default."

    As a best practice, never assume a cached item exists. Always check for NULL
    first and re-insert into the cache if it is NULL if thats your want.
    --

    - Paul Glavich
    ASP.NET MVP
    ASPInsider ([url]www.aspinsiders.com[/url])


    "bayam" <bayam@discussions.microsoft.com> wrote in message
    news:F6DA5AB2-F184-4291-A061-0150D1718597@microsoft.com...
    > I have a web application that inserts several enumerated lists into the
    Cache
    > on the Initialize event of global.asax:
    >
    > Cache _cache = Context.Cache;
    > _cache.Insert("Countries", htCountries);
    >
    > Sometime last night, the cached variable htCountries started to return a
    > null value, causing our code to crash. Nothing in the code assigns this
    > variable to null. Restarting the applicaton fixed the problem. (This
    > particular code has been around for 3 months, and this error has never
    > occurred before.)
    >
    > Is there a know security exploit of the .NET Cache object that would allow
    a
    > hacker to do this?

    Paul Glavich [MVP ASP.NET] Guest

  4. #3

    Default Re: Cache variable suddenly = null

    Also, if you want to be notified when something gets removed from the cache,
    attach the appropriate delegate so that you get called back when it happens.
    You can then find out when and why the item got ejected and reinsert it back
    into the cache if you need to.

    Joe K.

    "Paul Glavich [MVP ASP.NET]" <glav@aspalliane.com-NOSPAM> wrote in message
    news:e3FgLq1EFHA.3244@TK2MSFTNGP15.phx.gbl...
    > Any items stored in the cache are "volatile" and can be removed by the
    > system. Using the insert method you describe below, inserts the cached
    > item
    > with a default priority. The default being "Normal". The MSDN docs explain
    > this as.
    >
    > "Cache items with this priority level are likely to be deleted from the
    > cache as the server frees system memory only after those items with Low or
    > BelowNormal priority. This is the default."
    >
    > As a best practice, never assume a cached item exists. Always check for
    > NULL
    > first and re-insert into the cache if it is NULL if thats your want.
    > --
    >
    > - Paul Glavich
    > ASP.NET MVP
    > ASPInsider ([url]www.aspinsiders.com[/url])
    >
    >
    > "bayam" <bayam@discussions.microsoft.com> wrote in message
    > news:F6DA5AB2-F184-4291-A061-0150D1718597@microsoft.com...
    >> I have a web application that inserts several enumerated lists into the
    > Cache
    >> on the Initialize event of global.asax:
    >>
    >> Cache _cache = Context.Cache;
    >> _cache.Insert("Countries", htCountries);
    >>
    >> Sometime last night, the cached variable htCountries started to return a
    >> null value, causing our code to crash. Nothing in the code assigns this
    >> variable to null. Restarting the applicaton fixed the problem. (This
    >> particular code has been around for 3 months, and this error has never
    >> occurred before.)
    >>
    >> Is there a know security exploit of the .NET Cache object that would
    >> allow
    > a
    >> hacker to do this?
    >
    >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139