[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Re: Cache Not Available Problem

Alvin Bruney [ASP.NET MVP]

5/5/2005 2:02:00 AM

does it always throw this exception or randomly

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Mathew Uthup" <Mathew Uthup@discussions.microsoft.com> wrote in message
news:2FF4EC83-FC26-442D-A59B-BF311CCC6F30@microsoft.com...
> Does any one know Why and When the .Net Runtime Throws the "Cache Not
> Available" Exception Message. The Code Snppet That Causes the Problem is
> as
> follows.
> The Code..
>
> internal class EnvUtil :System.Web.UI.Page
> {
> //private string m_sResetClientId;
> internal EnvUtil()
> {
>
> }
> internal string ResetClientID
> {
> get
> {
> string sResetClientId="";
> try
> {
> if (Cache["ResetClientDoc"]
> == null)
> {
> TextReader xt=new
> StreamReader(Server.MapPath(@"../../Content/EnvReport/ResetClientID.xml"));
>
>
> sResetClientId=xt.ReadToEnd();
> xt.Close();
> CacheDependency dep
> = new
> CacheDependency(Server.MapPath(@"../../Content/EnvReport/ResetClientID.xml"),
> DateTime.Now);
>
>
>
> Cache.Insert("ResetClientDoc", sResetClientId, dep);
>
> }
> else
> {
>
> sResetClientId=(string) Cache["ResetClientDoc"];
>
> }
>
> }
> catch (Exception ex)
> {
>
> Debug.WriteLine(ex.Message);
> }
>
> return sResetClientId;
> }
> }
>
> }
> }
>
> ======================
> Output
> ?ex.Message
> "Cache is not available"
> =======================
>