Hi,
I have a website which loads images from a CDN. I have a requirement to check for the existence of 100s of images on the CDN.
I am using this code to achieve this:
Protected Function RemoteImageExists(ByVal Path As String) As Boolean
Dim httpRequest As HttpWebRequest = CType(WebRequest.Create(Path), HttpWebRequest)
httpRequest.Method = "HEAD"
Try
Dim httpResponse As HttpWebResponse = CType(httpRequest.GetResponse, HttpWebResponse)
Catch ex As Exception
Return False 'Undesirable flow, but seems unavoidable :(
End Try
Return True
End Function
This is still very slow, and many requests timeout. Is there a faster way to do this?
WT