Thursday, 12 December 2013

How to clear browser cache in ASP.NET

In this article I will explain How to clear browser cache in ASP.NET?

Many of us know that when we browse, history is stored in the form of Cookies and when we press back button the page will be loaded from that browser Cookie. We may face some problems with this.

Here is a Simple code to avoid this type of Problem. 

Paste this code in Page load of Master Page so that whenever you click on Browser back Button Entire Page will be loaded from the Code.

Use below C# code for expire browser cache.

Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

No comments:

Post a Comment