How to save .net XML document to path using & in

I am saving an XMLDocument object to disk using the Save (string) function . When I do this, I get the "Unable to find a pairing error" error.

I've tried passing characters like "&", "&", "% 26", "\ 26" and "\ 38". What am I missing? Please note that I am not talking about the contents of the file, but the name of the file.

Dim todocument As New Xml.XmlDocument
todocument.LoadXml(fromXml.OuterXml)
todocument.Save(toPath)

      

0


a source to share


2 answers


& (ampersands) are perfectly legal to enter filename / pathname. 2 things to check.



  • make sure the destination folder has
  • try storing it into a filestream object.
0


a source


My particular problem was not that neither were encoded - my '\'s in the path were encoded and they shouldn't have been.



0


a source







All Articles