clear cashe from web config

Hi Experts,
is there an option to clear the cashe form the web config of an application in asp.net?
shpresaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I don't know of any way in the web.config file, but I do know of this:

foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache){
    HttpContext.Current.Cache.Remove(string(entry.Key));
}

Open in new window


ASP.NET 4.5

foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache){
    HttpContext.Current.Cache.Remove((string)entry.Key);
}

Open in new window

0
Miguel OzSoftware EngineerCommented:
If you need to disable the cache for the whole site, then please add OutputCache key as explained here.
        <caching>
            <outputCache enableOutputCache="false"/>            
        </caching>

Open in new window

0
Bob LearnedCommented:
Disabling I have heard of, but not clearing...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shpresaAuthor Commented:
Hi Miguel Oz
where do you place the ??
 <caching>
            <outputCache enableOutputCache="false"/>            
        </caching>

web config?
0
Bob LearnedCommented:
That goes in the web.config file, under the <system.web> element:

<configuration>
    <system.web>
        <caching>
            <outputCacheSettings enableOutputCache="false"/>
        </caching>
    </system.web>
</configuration>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.