In my application (ASP.NET + c#) I need to clear the cache before a user enters an aspx page.
Does anybody have any idea how I can programmatically clear the cache on an aspx page, or in the code behind (c#)?
Write following code in the page load event:
protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now);
    Response.Cache.SetNoServerCaching();
    Response.Cache.SetNoStore();
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With