Hi there,
Take a look at the Cache keys you are using:
Code:
if (Cache["ContactFormMailBody"] == null)
{
mailBody = System.IO.File.ReadAllText(fileName);
Cache.Insert("ContactFormMailBody", mailBody, new CacheDependency(fileName));
}
else
{
mailBody = Cache["ContentFormMailBody"].ToString() + "\r\n(File from the cache)";
}
You check for one key (ContactFormMailBody) and insert that in the cache, but then in the else block you try to access another key (ContentFormMailBody).
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
Beginning ASP.NET 3.5 : in C# and VB,
ASP.NET 2.0 Instant Results and
Dreamweaver MX 2004
Want to be my colleague? Then check out this post.