What is the role of web page caching? It should be important. However, when developing network applications, Web Cache always gives us an inexplicable headache. So almost every Developer tried to solve this problem. Of course, I did not solve this problem today. But today, I am writing an article to record the methods used.
1. Disable the client cache to add the following content in
<META HTTP-EQUIV = "pragma" CONTENT = "no-cache">
<META HTTP-EQUIV = "Cache-Control" CONTENT = "no-cache, must-revalidate">
<META HTTP-EQUIV = "expires" CONTENT = "Wed, 26 Feb 1997 08:21:57 GMT">
2. Disable caching on the dynamic web page of the server. Add a script similar to the following:
(1) asp (not used for a long time ):
<%
Response. Expires =-1
Response. ExpiresAbsolute = Now ()-1
Response. cachecontrol = "no-cache"
%>
(2) jsp (the preferred choice for SUN Enterprise Applications) (I often use it now ):
Response. setHeader ("Pragma", "No-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires", 0 );