Page.Cache vs HttpContext.Current.Cache

Discussion in 'ASP .Net' started by DesignerX, Jan 20, 2004.

  1. DesignerX

    DesignerX Guest

    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
    DesignerX, Jan 20, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    >
    > 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
    >
    >
    Kevin Spencer, Jan 20, 2004
    #2
    1. Advertising

  3. DesignerX

    vMike Guest

    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" <> wrote in message
    news:...
    >
    > 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
    >
    >
    vMike, Jan 20, 2004
    #3
  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" <> wrote in message
    news:buk79p$mqu$...
    > 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" <> wrote in message
    > news:...
    > >
    > > 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
    > >
    > >

    >
    >
    Kevin Spencer, Jan 20, 2004
    #4
  5. DesignerX

    mikeb Guest

    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" <> wrote in message
    > news:...
    >
    >>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
    mikeb, Jan 20, 2004
    #5
  6. DesignerX

    vMike Guest

    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" <> wrote in message
    news:buk79p$mqu$...
    > 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" <> wrote in message
    > news:...
    > >
    > > 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
    > >
    > >

    >
    >
    vMike, Jan 20, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Olav Tollefsen

    HttpContext.Current.Cache configuration?

    Olav Tollefsen, Feb 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,063
    Karl Seguin
    Feb 14, 2005
  2. xzzy
    Replies:
    3
    Views:
    5,464
    Scott Allen
    Oct 1, 2005
  3. Replies:
    4
    Views:
    859
  4. Tony

    Dim context As HttpContext = HttpContext.Current

    Tony, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    295
    Teemu Keiski
    Mar 3, 2004
  5. Replies:
    3
    Views:
    355
Loading...

Share This Page