How to disable Caching on the browsers?

 Posted by vishalneeraj-24503 on 7/2/2014 | Category: ASP.NET Interview questions | Views: 1679 | Points: 40
Answer:

It's better way to disable caching,so the web page must be requested fresh or new each time from the server.

On Page Load event write below code:-

Response.Expires = 0;

Response.Cache.SetNoStore();
Response.AppendHeader("Pragma","no-cache");

So whenever the Page_Load event occures, it will ask a new copy from server, so that we can write code which will check that whether the request is valid or not.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response