473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Page.Cache vs HttpContext.Current.Cache


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
Nov 18 '05 #1
5 3678
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.

"DesignerX" <de********@yahoo-spam-me-not.com> wrote in message
news:6P********************@giganews.com...

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

Nov 18 '05 #2
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

"DesignerX" <de********@yahoo-spam-me-not.com> wrote in message
news:6P********************@giganews.com...

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

Nov 18 '05 #3
vMike wrote:
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.


"DesignerX" <de********@yahoo-spam-me-not.com> wrote in message
news:6P********************@giganews.com...
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


--
mikeb
Nov 18 '05 #4
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.

"vMike" <Mi****************@noZorY.geZwaYrrenY.com> wrote in message
news:bu**********@ngspool-d02.news.aol.com...
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

"DesignerX" <de********@yahoo-spam-me-not.com> wrote in message
news:6P********************@giganews.com...

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


Nov 18 '05 #5
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
"vMike" <Mi****************@noZorY.geZwaYrrenY.com> wrote in message
news:bu**********@ngspool-d02.news.aol.com...
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

"DesignerX" <de********@yahoo-spam-me-not.com> wrote in message
news:6P********************@giganews.com...

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


Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ryan | last post by:
The real reason for my previous post about intercepting Application_EndRequest (from outside of Global.asax) is because of a need to create a "non persistent page level cache". I can't seem to...
3
by: Peter Theill | last post by:
Hi, I'm trying to include the content of a request into an Xml document: if (System.Web.HttpContext.Current.Session != null) { XmlDocument d = new XmlDocument(); d.Load(new...
4
by: darrel | last post by:
Karl has helped me in the past in regards to communicating between controls and pages: http://www.openmymind.net/communication/index.html#3.1 I ended up going down the interfaces path and...
2
by: Mike Orb | last post by:
This is a Framework 1.x question. I'm creating a class that generates HTML element IDs (<foo id='id1'> for example) and need the element IDs to be unique across the page. The reusable class...
3
by: xzzy | last post by:
A. I need to access: System.Web.HttpContext.Current.Cache but get this error: "Object reference not set to an instance of the object" B. System.Web.HttpContext.Current.Cache is accessible...
1
by: =?Utf-8?B?ZGF2ZQ==?= | last post by:
I have an asp.net project with a business layer (project) that has a class called references. It loads up a data set and stores in cache with the following code. _cached =...
1
by: c83 | last post by:
after a user makes FormsAuthentication.SignOut(); Response.Redirect('login.aspx'); it is redirected to the login page. But if in the browser it pushes the Back button the last visited page...
4
by: msch-prv | last post by:
Hello. I am trying to use caching to populate a datalist. The select method of the associated objectdatasource calls up GetRecipePageByRecipeCatID() to request the proper data (I am using custom...
7
by: Andrew Jocelyn | last post by:
Hi I'm running an ASP.NET web application under IIS. I'm inserting a cache object with a file based CacheDependency. I've noticed that when the file changes the Cache object is not always...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.