Ausnahmefehler Webclient

  • VB.NET
  • .NET (FX) 4.0

    Ausnahmefehler Webclient

    Hallo.

    Und zwar geht es um folgenden Code:

    VB.NET-Quellcode

    1. Private Function GetIp() As Dataa
    2. Using Wc As New WebClient
    3. Try
    4. Dim T As String = Wc.DownloadString(New Uri("http://www.wieistmeineip.de/"))
    5. T = Regex.Match(T, "lautet:.+\s+[^\d]+([^<]+)").Groups(1).Value
    6. Return New Dataa("IP Address", "-", T, "-")
    7. Catch ex As Exception
    8. Throw New Exception(ex.StackTrace)
    9. End Try
    10. End Using
    11. End Function


    Ich erhalte jedes Mal:

    VB.NET-Quellcode

    1. Ein Ausnahmefehler des Typs "System.Exception" ist in TestProji.exe aufgetreten.
    2. Zusätzliche Informationen: bei System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
    3. bei System.Net.WebClient.DownloadString(Uri address)


    VB.NET-Quellcode

    1. Codezeile:Wc.DownloadString(New Uri("http://www.wieistmeineip.de/"))


    Habe auch schon:

    VB.NET-Quellcode

    1. Wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36")
    2. Wc.Headers.Add("Host","www.wieistmeineip.de")


    probiert, doch gleicher Fehler.

    Weiß jemand, warum?