I'm trying to load a XML file coming from a web request. The response is encoded in Base64String so I have to decode it first.
XmlDocument ResultXML = new XmlDocument();
....
// encPayload is the string returning from web request
byte[] data = Convert.FromBase64String(encPayload);
string decodedString = Encoding.UTF8.GetString(data);
ResultXML.LoadXml(decodedString);
The decoded string contains the XML that I want to load, but some values contains illegal characters (i.e '<', '>'), so I have to remove them before I can call XmlDocument LoadXml function. The decoded string can reach about 60/80 MB, so if I try to use Replace method I have OutOfMemoryException. How can I fix this problem? Thanks