C
Claudio Di Flumeri
In my application I use a sort od LiveUpdate to download updates from
internet. To do that, a .xml file hosted on an internet area contains all
the relevant information (like version, dimension, name of the file to
download etc.). To estabilish if the file .xml exists, the following
function is used:
Public Function HTTPResourceExist(ByVal IndirizzoURL As String) As
String
Dim request As HttpWebRequest
Dim response As HttpWebResponse
HTTPResourceExist= ""
request = HttpWebRequest.Create(IndirizzoURL)
Try
response = request.GetResponse
Catch ex As WebException
If ex.Status = WebExceptionStatus.ProtocolError Then
HTTPResourceExist= "No update available"
Else
HTTPResourceExist= "Error during connection"
End If
End Try
If Not response Is Nothing Then response.Close()
request.Abort()
End Function
In some cases, the GetResponse method raises an exception
(WebExceptionStatus.ProtocolError) just has the file hadn't be found. This
error happens ONLY with ADSL connections (not with dialup or other), but not
with ALL adsl connections, just with some of them. Do you know which could
be the cause of it?
Claudio
internet. To do that, a .xml file hosted on an internet area contains all
the relevant information (like version, dimension, name of the file to
download etc.). To estabilish if the file .xml exists, the following
function is used:
Public Function HTTPResourceExist(ByVal IndirizzoURL As String) As
String
Dim request As HttpWebRequest
Dim response As HttpWebResponse
HTTPResourceExist= ""
request = HttpWebRequest.Create(IndirizzoURL)
Try
response = request.GetResponse
Catch ex As WebException
If ex.Status = WebExceptionStatus.ProtocolError Then
HTTPResourceExist= "No update available"
Else
HTTPResourceExist= "Error during connection"
End If
End Try
If Not response Is Nothing Then response.Close()
request.Abort()
End Function
In some cases, the GetResponse method raises an exception
(WebExceptionStatus.ProtocolError) just has the file hadn't be found. This
error happens ONLY with ADSL connections (not with dialup or other), but not
with ALL adsl connections, just with some of them. Do you know which could
be the cause of it?
Claudio