我有一个在开发环境中工作的功能,但我需要更改路径,以便它在主机服务器上正确解析。
此代码行;
doc.Load("H:\Website_Sep2012\OtherDataFiles\dataXML.xml") 'this needs to be changed to the server path
在这个函数内
Public Shared Function GetList(ByVal nodestring As String) As List(Of String)
Dim doc As New XmlDocument()
'Load XML from the file into XmlDocument object
doc.Load("H:\Website_Sep2012\OtherDataFiles\dataXML.xml") 'this needs to be changed to the server path
Dim root As XmlNode = doc.DocumentElement
'Select all nodes with the tag paramter indicated by the nodestring variable
Dim nodeList As XmlNodeList = root.SelectNodes(nodestring)
Return (From node As XmlNode In nodeList Select node.InnerText).ToList()
End Function
将字符串替换为Server.MapPath("~/OtherDataFiles\dataXML.xml")
不起作用,因为 Server 在该范围内不可用。如何解决此路径的任何想法