<% Response.CacheControl = "no-cache" %>

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Huang

    <% Response.CacheControl = "no-cache" %>

    Hi,

    Kind of spending too much time on the no-cache issue and found out something
    like <% Response.CacheC ontrol = "no-cache" %>.
    In my ASP.Net, a C# .aspx file, where do I put the <% Response.CacheC ontrol
    = "no-cache" %>?
    Is this enough to fix the Caching bug?
    Thanks for help.

    Jason




  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: &lt;% Response.CacheC ontrol = &quot;no-cache&quot; %&gt;

    Hi,

    I think so, I have never do it that way, I use this line in the code behind:

    Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);


    cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation



    "Jason Huang" <JasonHuang8888 @hotmail.com> wrote in message
    news:O7u4bk8eFH A.3040@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Hi,
    >
    > Kind of spending too much time on the no-cache issue and found out
    > something like <% Response.CacheC ontrol = "no-cache" %>.
    > In my ASP.Net, a C# .aspx file, where do I put the <%
    > Response.CacheC ontrol = "no-cache" %>?
    > Is this enough to fix the Caching bug?
    > Thanks for help.
    >
    > Jason
    >
    >
    >
    >[/color]


    Comment

    • Joerg Jooss

      #3
      Re: &lt;% Response.CacheC ontrol = &quot;no-cache&quot; %&gt;

      Jason Huang wrote:
      [color=blue]
      > Hi,
      >
      > Kind of spending too much time on the no-cache issue and found out
      > something like <% Response.CacheC ontrol = "no-cache" %>. In my
      > ASP.Net, a C# .aspx file, where do I put the <%
      > Response.CacheC ontrol = "no-cache" %>? Is this enough to fix the
      > Caching bug? Thanks for help.[/color]

      Um... caching bug?

      Anyway, either set the OutputCache directive on your page(s)

      <%@ OutputCache Location="None" %>

      or set the Cache property of the HttpResponse in your code-behind class:

      Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);

      (which is equivalent to the directive shown above)

      Cheers,
      --

      mailto:news-reply@joergjoos s.de

      Comment

      Working...