XmlTextWriter and RSS files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeremy hillin

    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();
  • Peter Huang [MSFT]

    #2
    RE: XmlTextWriter and RSS files

    Hi Jeremy,

    I can not reproduce the problem.
    Here is my code.
    private void Page_Load(objec t sender, System.EventArg s 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.

    --------------------[color=blue]
    >Content-Class: urn:content-classes:message
    >From: "jeremy hillin" <jeremyhillin@o recity.com>
    >Sender: "jeremy hillin" <jeremyhillin@o recity.com>
    >Subject: XmlTextWriter and RSS files
    >Date: Thu, 18 Sep 2003 12:53:04 -0700
    >Lines: 17
    >Message-ID: <76c701c37e1e$7 93263d0$a601280 a@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/IbenIusTdalTRf6 3ukMpA==
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >Path: cpmsftngxa06.ph x.gbl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:109086
    >NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >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"
    >
    >
    >
    >XmlTextReade r 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();
    >[/color]

    Comment

    • Kieran Benton

      #3
      Re: XmlTextWriter and RSS files

      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" <jeremyhillin@o recity.com> wrote in message
      news:76c701c37e 1e$793263d0$a60 1280a@phx.gbl.. .[color=blue]
      > 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();[/color]


      Comment

      Working...