Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   XML cached document fails intermittantly (

Chris 03-13-2007 07:01 PM

XML cached document fails intermittantly
I have an XMLdocument which I keep in cache which I use on my page. I use
this function (in a separate dll) to read it from the cache and then read it
from file if the cache is empty. This seems to work 99.9% of the time. But
every couple of days or so the app throws an 'Object reference not set to an
instance of an object.' on the getElementByTagName line below. Can anyone
help on what would cause this problem. And any recomendations how to best
troubleshoot it? Is it a file access issue? Am I using the cache wrong?

xmlconfig = getcached_xml_doc(xmlpath, Me.xmlcachename)
nodelist = xmlconfig.GetElementsByTagName("nodes")

Public Function getcached_xml_doc(ByVal strxml As String, ByVal strcachename
As String) As XmlDocument
If HttpContext.Current.Cache(strcachename) Is Nothing Then
Dim xmldoc As New XmlDocument()
xmldoc.Load(HttpContext.Current.Server.MapPath(str xml))
HttpContext.Current.Cache.Insert(strcachename, xmldoc, New
CacheDependency(HttpContext.Current.Server.MapPath (strxml)))
'HttpContext.Current.Cache.Insert(strcachename, xmldoc)
End If
Return HttpContext.Current.Cache(strcachename)
End Function

All times are GMT. The time now is 03:37 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.