J
Jonathan
Calling the System.Net.WebResponse.GetResponse method (see
code below) results in the following error:
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())
The URL works ok in IE on the same PC.
Does anyone know what would cause this problem, what other
checks I could try or any other method to do the same
thing as System.Net.WebResponse.GetResponse?
Thank you in advance.
Private Function HasWebConnection() As Boolean
Dim bResult As Boolean
Try
bResult = True
Dim URI As New System.Uri("http://www.microsoft.com")
Dim TestRequest As Net.WebRequest =
Net.WebRequest.Create(URI)
TestRequest.Timeout = Threading.Timeout.Infinite
Dim TestResponse As Net.WebResponse =
TestRequest.GetResponse
Catch ex As Exception
Console.WriteLine(ex.ToString)
bResult = False
End Try
Return bResult
End Function
code below) results in the following error:
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())
The URL works ok in IE on the same PC.
Does anyone know what would cause this problem, what other
checks I could try or any other method to do the same
thing as System.Net.WebResponse.GetResponse?
Thank you in advance.
Private Function HasWebConnection() As Boolean
Dim bResult As Boolean
Try
bResult = True
Dim URI As New System.Uri("http://www.microsoft.com")
Dim TestRequest As Net.WebRequest =
Net.WebRequest.Create(URI)
TestRequest.Timeout = Threading.Timeout.Infinite
Dim TestResponse As Net.WebResponse =
TestRequest.GetResponse
Catch ex As Exception
Console.WriteLine(ex.ToString)
bResult = False
End Try
Return bResult
End Function