开发者_JAVA百科
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this questioni am creating dynamic controls based on the dropdownlist selection and data available in the database. For this i am using static variable. When we refresh the page using (f5,ctrl-f5,ctrl-r) value in the static varable remains. It creating problem. How to clear the cache when the page is refresh.
Geetha
I presume what you mean is that your server-side code is caching data and you want a client-side ctrl-F5 to clear your server-side cache?
In general this is a pretty bad idea - giving users the ability to purge your server-side caches will quickly cause performance issues.
If you really have to do this (and I sincerely recommend you don't) you could always look at the value of the request header cache-control
. Browsers will set it to no-cache
or max-age=0
when you refresh manually from the browser. When you see that simply clear your server-side caches.
ctrl-f5 or ctrl-r
A static variable stays there until the class is recycled (i.e. when IIS will recycle). If you want this to not be there on refresh then don't make it static.
精彩评论