XmlTextWriter and RSS files

J

jeremy hillin

I am trying to read the MSDN RSS.xml file and populate a
datagrid in an aspx page. I ran this same code in a
WinForm app and it works. I get this error on my aspx
page. I get the error on the ds.ReadXML( reader );

"The underlying connection was closed: Unable to connect
to the remote server"



XmlTextReader reader = new XmlTextReader
( "http://msdn.microsoft.com/rss.xml" );

DataSet ds = new DataSet();
ds.ReadXml( reader );
this.DataGrid1.DataSource = ds.Tables[2];
this.DataGrid1.DataBind();
 
P

Peter Huang [MSFT]

Hi Jeremy,

I can not reproduce the problem.
Here is my code.
private void Page_Load(object sender, System.EventArgs e)
{
XmlTextReader reader = new
XmlTextReader("http://msdn.microsoft.com/rss.xml" );
DataSet ds = new DataSet();
ds.ReadXml( reader );
this.DataGrid1.DataSource = ds.Tables[2];
this.DataGrid1.DataBind();
}

You may try to create a new project and paste the code to the Page_Load
event handling function to see
if the problem persists.
BTW, can you read the xml file from Localhost? You may download it to the
<wwwroot> directory.
e.g.
XmlTextReader reader = new XmlTextReader("http://localhost/rss.xml" );
BTW, do you have a proxy or firewall setting?


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top