Related Solutions

Several articles, including a .NET Developer Perspectives column that I wrote a few years ago ("Data Caching for Web Applications," August 21, 2001, InstantDoc ID 22925), address the topic of data caching for Web applications. Other authors have devised different solutions to the database cache dependency problem. In April 2003, Jeff Prosise's MSDN Magazine article, "Wicked Code: Supporting Database Cache Dependencies in ASP.NET" (, addressed the database cache dependency issue in ASP.NET 1.x and SQL Server. His solution was to write triggers on the tables associated with caches. The triggers called an extended stored procedure that modified a file on a network share. An instance of the CacheDependency class in ASP.NET monitored the file and invalidated the cache whenever the file changed.

Rob Howard also wrote and posted a helpful demo (which you can download at that applied almost the same concept, but his code dynamically created the cache dependency and associated trigger from the client, an ASP.NET Web application. Instead of modifying a file through an extended stored procedure, Howard's extended stored procedure made an HTTP call back to the Web server to expire the associated cache. In a series of two articles, "Invalidating an ASP.NET Web Application Cache Item from SQL Server" ( and "SqlDependency—Proof of Concept" (, Donny Mack enhanced Howard's code by refactoring some of the classes and procedures and explained the code in more detail.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.