473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

XmlTextWriter and RSS files

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();
Jul 21 '05 #1
2 2363
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.

--------------------
Content-Class: urn:content-classes:message
From: "jeremy hillin" <je**********@orecity.com>
Sender: "jeremy hillin" <je**********@orecity.com>
Subject: XmlTextWriter and RSS files
Date: Thu, 18 Sep 2003 12:53:04 -0700
Lines: 17
Message-ID: <76****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcN+Hnkw/IbenIusTdalTRf63ukMpA==
Newsgroups: microsoft.public.dotnet.general
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:109086
NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
X-Tomcat-NG: microsoft.public.dotnet.general

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();


Jul 21 '05 #2
Jeremy,

You need to do @"http://msdn.microsoft.com/rss.xml" in your construction of
reader. Without the @, the compiler interprets the string as
http:/msdn.microsoft.comss.xml

HTH
Kieran

"jeremy hillin" <je**********@orecity.com> wrote in message
news:76****************************@phx.gbl...
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();

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jain, Pranay Kumar | last post by:
Hello Everyone, I have written a simple app. that converts the dataset into excelspreadsheet. The App. uses the following architecture. First it generates the dataset with corresponding...
2
by: Steve | last post by:
I'm an XML newb. I'm serializing a class and when I inspect the xml file, all the data is on one line rather than being nested and indented Is that normal? <code> StreamWriter sw = new...
4
by: Einar Høst | last post by:
Hi, I'm having weird problems using StringWriter and XmlTextWriter. My code looks like this: StringWriter sw = new StringWriter(CultureInfo.InvariantInfo); XmlTextWriter xtw = new...
5
by: Robert Dickow | last post by:
Hi, My XML files created with XmlTextWriter routines has been resulting in working files, but they include three bytes of garbage at the start of the file. The bytes are: $EF $BB $BF (I think...
2
by: jeremy hillin | last post by:
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...
4
by: quest | last post by:
Is there anyway I can generate the xml in the following format using XmlTextWriter ? Intended output: <?xml version="1.0" ?> I tried: XmlTextWriter xmlWriter = new...
1
by: richardtallent | last post by:
(ASP.NET 2.0. Issue presents both on my copy of IIS on my workstation (XP Pro) and my production server (Win2k3). I don't use any proxy servers, anti-spyware apps, etc. Problem occurs using IE6SP2...
2
by: darrel | last post by:
We've been using xmltextwriter to write XML files to the filesystem. For various reasons, we're ditching the filesystem and want to store the XML as text in a DB field. Looking at all the...
3
by: GaryDean | last post by:
I'm using an XmlTextWriter and it's various methods such as WriteElementString, WriteStartElement, WriteEndElement, etc to create an xml document. When I instantiate the XmlTextWriter to a file......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.