467,888 Members | 1,383 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

Cache question

Via the -global.asax- file, on application startup,

the following code does not work:

System.Web.Caching.Cache.Insert (works on all other pages ...)

whereas this works fine:

HttpContext.Current.Cache.Insert

Can anyone explain why this is so?
Nov 17 '05 #1
  • viewed: 1716
Share:
1 Reply
On application start there is no automatically mapped reference to the
current Cache object.

The object is handled through the HttpContext.Current.

When you reference the Cache object (or session or application) on a page,
you are in the HttpContext.Current by default.

You will have to reference the Cache object through the HttpContext.Current
outside of a direct request for a page. That goes for a web control library
or anything else outside a page request.

I have even had trouble with it when I created two threads in the same web
request.

bill
"Alvin K" <as******@yahoo.com> wrote in message
news:cd**************************@posting.google.c om...
Via the -global.asax- file, on application startup,

the following code does not work:

System.Web.Caching.Cache.Insert (works on all other pages ...)

whereas this works fine:

HttpContext.Current.Cache.Insert

Can anyone explain why this is so?

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Joe Fallon | last post: by
5 posts views Thread by Darrel | last post: by
1 post views Thread by Brian Linden | last post: by
2 posts views Thread by Don Kelloway | last post: by
2 posts views Thread by LeAnne | last post: by
5 posts views Thread by Stan SR | last post: by
5 posts views Thread by J055 | last post: by
10 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.