tags:

views:

163

answers:

3

Hi all,

i 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

+1  A: 

ctrl-f5 or ctrl-r

Jeba Singh Emmanuel
That's not going to work for this problem. It's not the clients cache he want to be purged.
Ikke
+1  A: 

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.

ck
+1  A: 

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.

Tim Schneider
is there Anyother way to achieve this task?
Geetha