我如何在线加载需要用户名和密码的 Xdocument
How can i Load a Xdocument online who needs a username and a password
是否可以加载具有密码和用户名的 XML 文件,如下所示:
XDocument xmlDoc = XDocument.load("htt://myApp/MyTestFile", "Username", "passwordtest");
请帮忙,我正在为我的应用程序保留最后一点。
How can i Load a Xdocument online who needs a username and a password
您可以设置 Credentials property of the XmlUrlResolver,如文档所述:
Sets credentials used to authenticate web requests.
然后对 XDocument
使用 XmlReader and XmlReaderSettings。
像这样:
XmlUrlResolver res = new XmlUrlResolver();
res.Credentials = new NetworkCredential("username", "password");
XmlReaderSettings set = new XmlReaderSettings();
set.XmlResolver = res;
XDocument xmlDoc = XDocument.Load(XmlReader.Create("htt://myApp/MyTestFile", set));
是否可以加载具有密码和用户名的 XML 文件,如下所示:
XDocument xmlDoc = XDocument.load("htt://myApp/MyTestFile", "Username", "passwordtest");
请帮忙,我正在为我的应用程序保留最后一点。
How can i Load a Xdocument online who needs a username and a password
您可以设置 Credentials property of the XmlUrlResolver,如文档所述:
Sets credentials used to authenticate web requests.
然后对 XDocument
使用 XmlReader and XmlReaderSettings。
像这样:
XmlUrlResolver res = new XmlUrlResolver();
res.Credentials = new NetworkCredential("username", "password");
XmlReaderSettings set = new XmlReaderSettings();
set.XmlResolver = res;
XDocument xmlDoc = XDocument.Load(XmlReader.Create("htt://myApp/MyTestFile", set));