When working with the SharePoint Client Object Model to remotely access Documents and Lists held in Office 365, we encountered the following error message:
An unhandled exception of type ‘System.Xml.XmlException’ occurred in System.Xml.dll Additional information: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
After some research, this error appears to originate from where our Client (i.e the Web Application or other App) that is communicating to SharePoint Online is then unable to receive back the XML from the Client Object Model correctly.
Oddly, this is not connected to the code invoking the Client Object Model or to how we are calling out; but instead is where your Request to SCOM is being bounced or rerouted before reaching SharePoint Online; this then breaks the Trust between your Client and SharePoint and so leads to this error message as SharePoint then rejects the untrusted message.
This can happen when working with a Wifi Extender, or working with an ISP such as Virgin Media that performs Advanced Search Service to introduce this security distrust.
The following links from Stack Overflow and various Blogs are useful in understanding this error and avoiding time trying to problem-solve at the code level:
In our case, the culprit was our Virgin Media connection and so we could resolve by deploying the App to one of our Dev Servers to see the same codebase working correctly –however this is one of those errors that can have a variety of causes connected with DNS and Routing:
The following post is great and goes into this in some more detail:
Hope that helps if you see a similar issue – thanks to these articles online, we managed to resolve fairly quickly but without these prior experiences am sure we would have been scratching our heads and rewriting connection code until more belatedly realising our underlying connection was the problem!