I have an xml string that is sent to the ashx handler on the server. The xml string is built on the client side and is based on several different elements made in the form. Sometimes, some users copy and paste from other sources into a web form. When I try to load an xml string into an XMLDocument object using xmldoc.LoadXml(xmlStr) , I get the following exception:
System.Xml.XmlException = {"'', hexadecimal value 0x0B, is an invalid character. Line 2, position 1."}
In debug mode, I see a rogue character (sorry, I'm not sure about the official name?):
My questions are: how can I clear the xml string before I try to load it into an XMLDocument object? Do I need a special function to parse all of these character types, one or one, or can I use my own .NET4 class to remove them?

source share