Source Code Download hangs...


Well-known member
Jul 16, 2004
Programming Experience
Some background on my program first. Flickr has a photo group that is all wallpaper images, over 12,000 of them. I made a program that downloads a random one out of the bunch.

To do this you first need to do three steps
  1. download the source code from a gallery page and find the name of the photo
  2. download the source code from the photos homepage to find the address to the photo itself.
  3. Then you can use that to download the photo.
My problem is this, I tell it to go through and get me a random photo for my background, it works perfectly, I tell it to do it again, and it works, then after this point there is about a 50% chance that it will fail on step 2. What happens is it just sits there waiting for a response from the website then eventually times out.

My code to download source code is:
        Dim wrq As WebRequest = WebRequest.Create(website)
        Dim wrp As HttpWebResponse = DirectCast(wrq.GetResponse(), HttpWebResponse)
        Dim sr As StreamReader = New StreamReader(wrp.GetResponseStream)
        Dim SourceCode As String = sr.ReadToEnd()

Which is taken pretty much word for word from another post I read on these forums. Thanks in advance for any help you can give.
Top Bottom