public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
DataSet ds = new DataSet();
ds.ReadXml(@"http://tecnologia.ig.com.br/rss.xml");
XmlDocument doc = new XmlDocument();
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = new System.Net.NetworkCredential("bruno", "*****");//intentionally hiding real password from stackoverflow
doc.XmlResolver = resolver;
foreach (DataRow dr in ds.Tables["item"].Rows)
{
Response.Write("Item TITLE: " + dr["title"].ToString() + "<br />");
Response.Write("Descrição : " + dr["description"].ToString() + "<br />");
Response.Write("Data de Publicação: " + dr["pubDate"].ToString() + "<br />");
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
我执行代码,系统返回两个错误
1 - 名为“链接”的列已属于此数据表:无法将嵌套表名称设置为相同的名称。2 - 远程服务器返回错误:(407) 需要代理身份验证。
谢谢!