G
Gavin Pollock
Is anyone using Caching (HttpRuntime.Cache) in Whidbey? Not sure if there's
another newsgroup for this though since it's still beta....
I'm having issues running a system built on 1.1 in a 2.0 environment...
Simple (I think!!) use of the Cache as below,
BOSContext bosContext = new BOSContext();
StringBuilder Html = new StringBuilder();
if (bosContext.Context.Cache[cacheKey] == null ||
!(bosContext.Context.Cache[cacheKey] is StringBuilder))
{
if (xNav == null)
throw new Exception("Side Menu not initialised");
Html.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%'
border='0' class='" + cssClassTable + "'>");
xNav.MoveToRoot();
xNav.MoveToFirstChild();
DisplayTree(xNav, 0);
Html.Append("</TABLE>");
System.Web.Caching.CacheDependency dep = new
System.Web.Caching.CacheDependency(_Filename);
bosContext.Context.Cache.Insert(cacheKey, Html, dep,
DateTime.Now.AddMinutes(15), System.Web.Caching.Cache.NoSlidingExpiration);
}
Html = ((StringBuilder) bosContext.Context.Cache[cacheKey]);
writer.WriteLine(Html.ToString()); //**
And the system is crashing on the //** line with "Object reference not set
to an instance of an object.". I would've thought that the check in the
first line would capture if the StringBuilder was null and instantiate it
there!
another newsgroup for this though since it's still beta....
I'm having issues running a system built on 1.1 in a 2.0 environment...
Simple (I think!!) use of the Cache as below,
BOSContext bosContext = new BOSContext();
StringBuilder Html = new StringBuilder();
if (bosContext.Context.Cache[cacheKey] == null ||
!(bosContext.Context.Cache[cacheKey] is StringBuilder))
{
if (xNav == null)
throw new Exception("Side Menu not initialised");
Html.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%'
border='0' class='" + cssClassTable + "'>");
xNav.MoveToRoot();
xNav.MoveToFirstChild();
DisplayTree(xNav, 0);
Html.Append("</TABLE>");
System.Web.Caching.CacheDependency dep = new
System.Web.Caching.CacheDependency(_Filename);
bosContext.Context.Cache.Insert(cacheKey, Html, dep,
DateTime.Now.AddMinutes(15), System.Web.Caching.Cache.NoSlidingExpiration);
}
Html = ((StringBuilder) bosContext.Context.Cache[cacheKey]);
writer.WriteLine(Html.ToString()); //**
And the system is crashing on the //** line with "Object reference not set
to an instance of an object.". I would've thought that the check in the
first line would capture if the StringBuilder was null and instantiate it
there!