Hi,

I want to disable the cache in browser using asp.net.If I click the back button of the browser the value of cache should be changed.

Can anyone help on this how to do??

Regards,
Pavan Kumar

<%@ OutputCache Duration="1" VaryByParam="none" %>

You can put this code just under

<%@ Page  Language="C#">

.. Hope this helps..:)

<%@ OutputCache Duration="1" VaryByParam="none" %>

You can put this code just under

<%@ Page  Language="C#">

.. Hope this helps..:)

Thanks for the reply

The code i had written in Pageload was:

Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);

The cache disable is working well with the browsers IE,Mozilla,Chrome if i clicked back button;but not in Safari.

Your code is correct, but you can use this:

Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
HttpContext.Current.Response.Cache.SetCachebility(HttpCacheability.NoCache)
Response.Cache.SetNoStore

But make sure you import system.web.caching.cache

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.