Still cannot sadz

Hi everyone,

I am currently developing a rss reader using vb.net windows application for my project. But at school, the codes that i have works. At home it does not!! I am really lost and have no idea what to do with it. Can kind souls please help out.

The error:

An unhandled exception of type 'System.Net.WebException' occurred in system.xml.dll

Additional information: The underlying connection was closed: An unexpected error occurred on a receive.

Dim doc As New XmlDataDocument

doc.Load(strUrl) ---->> the codes always will generatea error here.

strUrl is jus a String containing URL for the xml links

e.g.

http://reviews.cnet.com/4534-10921_7-0.xml

Thanks a lot.



Answer this question

Still cannot sadz

  • Stefano Crosatti

    I am sorry MarcD but do you have any idea what network error would it be.

    What things i am using:

    -avast! antivirus

    -linksys router, ADSL ethernet modem

    -Windows Xp professional

    I have tried plucking out the router and jus use the modem connect straight to my com but to no luck, it stills give me the same error. If need more other info i am willing to give. jus tell me wat other info is needed.

    Thanks for all the help so far.


  • Don Demsak

    Hi,

    Instead of loading the data directly, create a WebClient and see if it gets the stream, and try to debug from there...

    try

    {

    XmlDataDocument doc = new XmlDataDocument();

    System.Net.WebClient wc = new System.Net.WebClient();

    Stream instream = wc.OpenRead("http://reviews.cnet.com/4534-10921_7-0.xml");

    doc.Load(instream);

    doc.WriteContentTo(new XmlTextWriter(Console.Out));

    }

    catch (System.Net.WebException wex)

    {

    Console.WriteLine(wex.ToString());

    }



  • Jiang_ZZZ

    It still does not work no matter how i try.

    Hi,

    Instead of loading the data directly, create a WebClient and see if it gets the stream, and try to debug from there...

    try

    {

    XmlDataDocument doc = new XmlDataDocument();

    System.Net.WebClient wc = new System.Net.WebClient();

    Stream instream = wc.OpenRead("http://reviews.cnet.com/4534-10921_7-0.xml");

    doc.Load(instream);

    doc.WriteContentTo(new XmlTextWriter(Console.Out));

    }

    catch (System.Net.WebException wex)

    {

    Console.WriteLine(wex.ToString());

    }

    I tried to use this set of codes but i notice that it is in java or csharp not vb. So i do not know what is Stream instream in vb.

    Next i also tried other ways your say like XmlDocument it stills give me the same problem too. I have no ideas left pls help.

    Below are the codes i have tried.

    Public Sub getHeaderList2(ByVal strUrl As String)

    Dim reader As New XmlTextReader("http://reviews.cnet.com/4534-10921_7-0.xml")

    Dim ds As DataSet = New DataSet

    ds.ReadXml(reader)

    End Sub

    Public Sub getHeaderList1(ByVal strUrl As String)

    Try

    Dim doc As New XmlDataDocument

    Dim wc As New System.Net.WebClient

    doc.Load(wc.OpenRead("http://reviews.cnet.com/4534-10921_7-0.xml"))

    doc.WriteContentTo(New XmlTextWriter(Console.Out))

    Catch wex As System.Net.WebException

    Console.WriteLine(wex.ToString())

    End Try

    End Sub

    Public Sub getHeaderList(ByVal strUrl As String)

    Dim doc As New XmlDataDocument

    doc.Load(strUrl)

    Dim root As XmlElement

    root = doc.DocumentElement

    Dim m_nodeRoot As XmlNodeList

    m_nodeRoot = doc.SelectNodes("/rss/channel")

    Dim itemNode As XmlNodeList

    itemNode = doc.SelectNodes("/rss/channel/item")

    Dim count As Integer

    For Each item As XmlNode In itemNode

    count = count + 1

    addnewHeader_headerList(item.SelectSingleNode("title").InnerText, count)

    Next

    End Sub

    Please help me!!!


  • Vladimir Kovalenko

    At least now we know that your problem has nothing to do with XML and document load method.



  • bsmith

    This is the error i got using webclient:

    System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.

    at System.Net.HttpWebRequest.CheckFinalStatus()

    at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

    at System.Net.HttpWebRequest.GetResponse()

    at System.Net.WebClient.OpenRead(String address)

    at RSSReader.Form1.getHeaderList1(String strUrl) in C:\Inetpub\wwwroot\RSSReader\Form1.vb:line 403


  • Mariant

    One more thing:

    Some sites have DDOS protection. When you are testing the code you may overload the server with your requests and it can block you for some time. try some other rss sources.



  • carl lorentson

    As my original post stated the exception is a network error.

  • Quadrillion

    If you don't use DataSet you don't need XmlDataDocument.

    Consider using XmlDocument or XPathDocument instead.



  • Alexander Podelko

    I should have done this a few days ago. heh

    Public Function GetRssFeed(ByVal path As String) As Xml.XmlDocument
    Dim TmpUrl As String = path
    Dim TmpRequest As Net.WebRequest = Net.WebRequest.Create(TmpUrl)
    Dim TmpResponse As Net.WebResponse = TmpRequest.GetResponse()
    Dim TmpReader As New IO.StreamReader(TmpResponse.GetResponseStream(), System.Text.Encoding.ASCII)
    Dim TmpContent As String = TmpReader.ReadToEnd()
    Dim TmpXml As New Xml.XmlDocument
    TmpXml.LoadXml(TmpContent)
    GetRssFeed = TmpXml
    End Function

    Try that function. It's easy to use and can be used as such.

    MsgBox(GetRssFeed("http://reviews.cnet.com/4534-10921_7-0.xml").InnerXml)

    The function returns an XmlDocument. In this example i'm simply outputting it for purposes.

  • Gordon Hogenson

    The exception happens a few seconds after i press the button that retreives the update.

    As for my internet connection speed it should be fast enough. But as for my house, i do have a router and i don't use any firewall except for the windows firewall.

    Please help me MarcD. Thanks a lot.


  • Pramey

    So how any idea to help me
  • sachin.pithode

    The exception is a networking exception which is occurring while trying to retrieve the document from the internet. When the exception happens does it happen right away or a few seconds after pressing the button that retreives the updates Are you on an extremely slow connection Doees your system have a firewall and have you configured your firewall to have access to it

  • andymaris

    ok I found out how to use how to write Stream and so i wrote this codes:

    Try

    Dim doc As New XmlDataDocument

    Dim wc As New System.Net.WebClient

    Dim instream As Stream = wc.OpenRead("http://reviews.cnet.com/4534-10921_7-0.xml")

    doc.Load(instream)

    doc.WriteContentTo(New XmlTextWriter(Console.Out))

    Catch wex As System.Net.WebException

    Console.WriteLine(wex.ToString())

    End Try

    But there is still the same error how am i surpose to debug can your please teach me pls!!


  • lasa

    Have you tried other RSS feeds on the web Try creating a clean, new project that just reads the rss feed into a string.Don't copy paste anything, try to see where is the error that you could have done.

  • Still cannot sadz