之前都好好的,现在莫名其妙的报错了!
报的错误是: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.
中文意思是:出于安全原因,在此XML文档中禁止使用DTD。 要启用DTD处理,请将XmlReaderSettings上的DtdProcessing属性设置为解析并将设置传递到XmlReader.Create方法。
网上搜索了 N 久,全是关于 XmlReaderSettings 怎么怎么设置。但是我只是一句简单的 download 而已,没有什么 XmlReaderSettings!我 download 的URL 是 office 365 的 SharePoint。
private static byte[] DownloadAttachment(WebClient client, string uri)
{
return client.DownloadData(uri);
}
WebClient 做过一些属性设置,大致是这样:
webClient.Credentials = GlobalData.SharePointOnlineCredentials;
webClient.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
SharePointOnlineCredentials 就是一个同名的用账户名和密码构建的 SharePointOnlineCredentials 对象。
请问这个问题如何解决?郁闷,凌晨 发帖,请大伙帮忙!谢谢!