I have some xml files which contain the source data for populating dropdown lists in my pages. These dropdowns are re-populated based on selected items from other dropdwons. I am getting a server error
Could not find a part of the path
X:\ASP.Net\CommodDisplay\DataFiles\dataXML.xml’.
Even though this is a valid path.
Here is the code im using to call it;
Dim doc As New XmlDocument()
'Load XML from the file into XmlDocument object
doc.Load(HttpContext.Current.Server.MapPath("~/DataFiles/dataXML.xml"))
Dim root As XmlNode = doc.DocumentElement
'Select all nodes with the tag Book
Dim nodeList As XmlNodeList = root.SelectNodes("futures")
For Each node As XmlNode In nodeList
ddlMainsub1.Items.Add(node.SelectSingleNode("product").InnerText)
Next
I also tried it just using Server.MapPath and I get the same error. These files are in a networked drive. Does that matter?
You asp.net service is running under a different user account then your own. You should be sure the service account has access to the path:
If part of the path is a network mapping it is possible that it is mapped for you but not for the service account running your website. Put all files local and try if that helps.