Page.Cache vs HttpContext.Current.Cache

D

DesignerX

What is the difference between Page.Cache and HttpContext.Current.Cache? Do
these access the same thing? Is there any easy way to clear all items in the
cache?

TIA,

Stan
 
K

Kevin Spencer

They are the same thing.

There is no Clear method for the Cache, so you would have to loop through it
and call Remove on each item to clear it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
V

vMike

I haven't had any luck with the remove method. What will work is something
like the following
Cookie = New HttpCookie("yourcookieidtoremove")
Cookie.Values.Add("yourcookievalueName,"")
cookie.expires=datetime.now.adddays(-5)
HttpContext.Current.Response.Cookies.add(Cookie)

This method will remove the cookie
 
K

Kevin Spencer

I don't recall anything in the question about cookies....

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

mikeb

vMike said:
I haven't had any luck with the remove method. What will work is something
like the following
Cookie = New HttpCookie("yourcookieidtoremove")
Cookie.Values.Add("yourcookievalueName,"")
cookie.expires=datetime.now.adddays(-5)
HttpContext.Current.Response.Cookies.add(Cookie)

This method will remove the cookie

Cookies have nothing to do with the cache.
 
V

vMike

Sorry, you're right. I thought I saw cookie. This will work

dim objItem as DictionaryEntry
dim strName as String

For Each objItem In Cache
strName = objItem.Key.tostring()
cache.remove(strName)
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top