Prevent browser from caching

Discussion in 'ASP .Net' started by Shardul Kulkarni, Mar 16, 2005.

  1. Hi All,

    What is the most reliable method of preventing a page from being cached by
    the browser? I'm using ASP.NET v1.1.

    Thanks.
    Shardul.
     
    Shardul Kulkarni, Mar 16, 2005
    #1
    1. Advertising

  2. Response.Expires = 0
    Response.Cache.SetNoStore()
    Response.AppendHeader("Pragma", "no-cache")

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Shardul Kulkarni" <> wrote in message
    news:...
    > Hi All,
    >
    > What is the most reliable method of preventing a page from being cached by
    > the browser? I'm using ASP.NET v1.1.
    >
    > Thanks.
    > Shardul.
    >
    >
     
    Steve C. Orr [MVP, MCSD], Mar 16, 2005
    #2
    1. Advertising

  3. Shardul Kulkarni

    Joerg Jooss Guest

    Steve C. Orr [MVP, MCSD] wrote:

    > Response.Expires = 0
    > Response.Cache.SetNoStore()
    > Response.AppendHeader("Pragma", "no-cache")
    >


    Unless you really need "Cache-Control: no-store", I would prefer the
    shorter
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    which is equivalent to the cache directive
    <%@ OutputCache Location="None" %>


    Cheers,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Mar 19, 2005
    #3
    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. R. Ian Lee

    Prevent Browser Caching for a Page

    R. Ian Lee, Oct 22, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    8,333
    Jacob Yang [MSFT]
    Oct 23, 2003
  2. gu4y
    Replies:
    2
    Views:
    411
    Shiv Kumar
    Jan 20, 2004
  3. Niclas
    Replies:
    1
    Views:
    412
    Niclas
    Jan 4, 2006
  4. Cesare Caldieron

    prevent page caching

    Cesare Caldieron, Aug 23, 2004, in forum: Java
    Replies:
    0
    Views:
    443
    Cesare Caldieron
    Aug 23, 2004
  5. greylin
    Replies:
    0
    Views:
    418
    greylin
    May 16, 2008
Loading...

Share This Page