Problem Reading XML file from the Web RRS feed

  • Question

  • Hi there!

    The following code works nice with Console Application.

    Imports System.Text.RegularExpressions
    Imports System.Net
    Imports System.IO
    Module Module1
        Sub Main()
        End Sub
        Private Sub findInfo(ByVal infoID As String)
            Dim wc As WebClient = New WebClient()
            AddHandler wc.OpenReadCompleted, AddressOf wc_OpenReadCompleted
            ' define URI
            Dim uriString = "http://cep.republicavirtual.com.br/web_cep.php?cep=" + infoID + "&formato=xml"
            wc.OpenReadAsync(New Uri(uriString))
        End Sub
        Private Sub wc_OpenReadCompleted(sender As Object, e As System.Net.OpenReadCompletedEventArgs)
            If e.Error IsNot Nothing Then
            End If
            Using s As Stream = e.Result
                Dim xDoc = XDocument.Load(s)
            End Using
        End Sub
    End Module

    If I try to use it with a LS project I get the following error message:

    Thanks in advance for any kind of hep.

    Best regards,


    Tuesday, October 29, 2013 7:03 PM