我尝试使用以下脚本从Exchange服务器读取电子邮件:
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ProhibitDtd = false;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CertificateValidationCallBack);
service.Credentials = new WebCredentials("user", "password" , "domain");
service.UseDefaultCredentials = true;
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.Url = new Uri("https://IP/");
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
Label1.Text = inbox.DisplayName.ToString();`
但我得到了这个错误:
此XML文档中禁止使用DTD。
我尝试这个解决方案:
XmlReaderSettings xrs = new XmlReaderSettings(); xrs.ProhibitDtd = false; 但错误就在那里。
答案 0 :(得分:0)
XmlReaderSettings xrs = new XmlReaderSettings()
xrs.DtdProcessing = DtdProcessing.Parse;
记录于:https://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.dtdprocessing(v=vs.110).aspx