1

I have a asp.net web application and I'm using cache (HttpRuntime.Cache) to save some stuff from db.

I also update db from time to time so that data in db does not match the data in my application's cache.

Is there any way how to clear my application's cache without modifying any source code or republishing the page?

I tried to restart IIS and to clear browsers cache but nothing helps.

Please help.

braX
  • 11,506
  • 5
  • 20
  • 33
dani
  • 469
  • 3
  • 12
  • 23

3 Answers3

4

Create admin page for restarting your application and put

HttpRuntime.UnloadAppDomain();

to button_click or similar.

Mike Koder
  • 1,898
  • 1
  • 17
  • 27
2

Restarting IIS will work - since the cache is kept in memory. If you're using SQL Server you can set up a cache dependency to automatically expire your cache when SQL Server is updated.

http://msdn.microsoft.com/en-us/library/ms178604.aspx

Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
0

Try this: Clearing Page Cache in ASP.NET

Community
  • 1
  • 1
Kevin
  • 1,723
  • 2
  • 17
  • 16