Caching XML file

Last post 06-30-2005 11:11 AM by SonuKapoor. 1 replies.

Sort Posts:

  • Caching XML file

    06-30-2005, 10:37 AM
    • Participant
      1,446 point Participant
    • gp_330
    • Member since 05-07-2003, 6:31 AM
    • Posts 301
    Hi guys,

    I am trying to cache an XML file that is read repeatedly by my site but I think that I am doing something quite wrong cause when I run my code I get the following error:

    No accessible overloaded 'XmlDocument.Load' can be called without a narrowing conversion

    Does anyone have any suggestions as to what I am doing wrong?  Here is my code below:

    <code>
    Dim siteMapFile As String = Cstr(ConfigurationSettings.AppSettings("siteMap"))

                        Dim siteMap As New XmlDocument()
                       
                        If System.Web.HttpContext.Current.Cache.Get("Site") IS Nothing Then
                           
                            Dim myDataSet as New DataSet()                       
                            myDataSet.ReadXml(Server.MapPath(SiteMapFile))
                            System.Web.HttpContext.Current.Cache.Insert("Site", myDataSet, New CacheDependency(Server.MapPath(SiteMapFile)))
                            siteMap.Load(System.Web.HttpContext.Current.Cache.Get("Site"))
                       
                        Else
                           
                            siteMap.Load(System.Web.HttpContext.Current.Cache.Get("Site"))
                           
                        End if
    </code>

    I would really appreciate any assistance that I get. Thanks

  • Re: Caching XML file

    06-30-2005, 11:11 AM
    • Star
      13,171 point Star
    • SonuKapoor
    • Member since 04-11-2004, 8:24 AM
    • Montreal/Canada
    • Posts 2,652
    • TrustedFriends-MVPs
    You are storing the dataset mydataset into the cache and trying to load it via the XmlDocument class. You cant load a dataset from a XmlDocument class.
Page 1 of 1 (2 items)