B
Bryan
When I try to get a web page from an internal server, I have success
when I use the DNS name, but not when I use the raw IP address. The
first example works, the second does not. Why is this?
Example 1
--------------------------------------------------------------------------------------------------
' Get web page
Dim url As String = "http://brysrv:5004/"
Dim client As WebClient = New WebClient
Dim data As Stream = client.OpenRead(url)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = reader.ReadToEnd
reader.Close()
Console.WriteLine(str)
Example 2
--------------------------------------------------------------------------------------------------
' Get web page
Dim url As String = "http://10.0.45.67:5004/"
Dim client As WebClient = New WebClient
Dim data As Stream = client.OpenRead(url)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = reader.ReadToEnd
reader.Close()
Console.WriteLine(str)
when I use the DNS name, but not when I use the raw IP address. The
first example works, the second does not. Why is this?
Example 1
--------------------------------------------------------------------------------------------------
' Get web page
Dim url As String = "http://brysrv:5004/"
Dim client As WebClient = New WebClient
Dim data As Stream = client.OpenRead(url)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = reader.ReadToEnd
reader.Close()
Console.WriteLine(str)
Example 2
--------------------------------------------------------------------------------------------------
' Get web page
Dim url As String = "http://10.0.45.67:5004/"
Dim client As WebClient = New WebClient
Dim data As Stream = client.OpenRead(url)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = reader.ReadToEnd
reader.Close()
Console.WriteLine(str)