0

I sell lots of music on eBay. I have a tool that takes in a URL of an album on Discogs.com and creates an information panel that I then copy into an eBay item description. The I use System.Net.Webclient.Downloadstring() to download the page's source, then Regex expressions to pull out the album information I need. This has worked fine for months, but for a couple days now, I get this error:

"The underlying connection was closed: An unexpected error occurred on a send."

I get this error when trying to use DownloadString() on ANY discogs.com page. I can load these pages in a browser just fine. Here's a random example of an album page: https://www.discogs.com/Apocalyptica-7th-Symphony/release/6520402

    Dim wbClient As New WebClient
    wbClient.Encoding = UTF8Encoding.UTF8
    wbClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")

    Dim strPageData As String = wbClient.DownloadString("https://www.discogs.com/" & strPageURL)
  • What is the value of `strPageURL`? What happens if you open your browser in incognito mode (i.e. without logging in) and you try and download that URL? – mjwills Sep 15 '17 at 05:41
  • strPageURL is the rest of the URL (example: "Apocalyptica-7th-Symphony/release/6520402") I have it written this way because of the way search results are written in the HTML. Discogs pages work fine in a browser's incognito mode. – Roger Leroy Sep 15 '17 at 06:56
  • Did the duplicate link work for you @RogerLeroy ? – mjwills Sep 15 '17 at 10:08
  • No, unfortunately I don't understand how that other question even relates to my issue. I am using System.Net.Webclient. – Roger Leroy Sep 18 '17 at 06:17
  • Did adding `ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12` to your code help? – mjwills Sep 18 '17 at 06:18
  • My bad, it took me a minute to understand. That did not work, however adding ServicePointManager.SecurityProtocol = DirectCast(3072, SecurityProtocolType) DOES work. Thank you for pointing me in the right direction. – Roger Leroy Sep 18 '17 at 06:39
  • I am surprised that 3072 works and Tls12 doesn't. They are exactly the same. _I suspect that the website swapped certs recently to not support SSL3, which likely caused your issue._ Also see https://stackoverflow.com/a/35851259/34092 . – mjwills Sep 18 '17 at 06:47

0 Answers0