从响应中读取数据

时间:2010-07-17 21:19:11

标签: c# asp.net

HttpWebRequest request = WebRequest.Create("https://www.google.com/accounts/o8/id") as HttpWebRequest;  
request .Accept = "application/xrds+xml";  
HttpWebResponse response = (HttpWebResponse)request .GetResponse();

返回xrds文档。 如何阅读该文件。

2 个答案:

答案 0 :(得分:2)

取决于你想要做什么 - 如果你只需要阅读回来的内容,那么你可以将文档加载到XmlDocument中并以编程方式检查它,例如。

XmlDocument rdsDocument;

HttpWebRequest request = WebRequest.Create("https://www.google.com/accounts/o8/id") as HttpWebRequest;
request.Accept = "application/xrds+xml";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

rdsDocument = new XmlDocument();
rdsDocument.Load(response.GetResponseStream());

答案 1 :(得分:0)

我认为这就是你所追求的目标

http://code.google.com/p/myspaceid-csharp-sdk/wiki/OpenStack