Results 1 to 10 of 10

Thread: [Resolved] Request was aborted? (SSL/TLS)

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    35

    [Resolved] Request was aborted? (SSL/TLS)

    So i have been working on a program on and off for the last month or so and last night i was working on said program no problem, everything worked and loaded fine.

    Today i booted up and just ran the program and i now get this error
    Additional information: The request was aborted: Could not create SSL/TLS secure channel.
    I am using the HTMLAgility-Pack. I have a strong feeling that the website that i am getting the information from has changed something to block me getting information this way? I say this as i loaded up a different program that i have made that pretty much does the same thing and i get the error there as well but when i try to scrape some data from a different website it works.

    Is there any way to fix this?
    Last edited by lynx2011; Apr 26th, 2017 at 12:01 PM.

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Request was aborted? (SSL/TLS)

    I don't think that error has anything to do with HTML Agility pack. SSL/TLS has to do with creating an HTTPS connection, which means it has more to do with how you're connecting to the site to download the HTML.

    What's your Windows version? How are you getting the HTML? Are you by chance using Mono instead of the .NET Framework? There's a lot of reasons you may be failing to establish this connection. But there's also this:

    when i try to scrape some data from a different website it works.
    This raises the possibility that the site's certificates are expired, which indicates the connection isn't as secure as it could be, which tends to cause .NET's networking to die. You can get around it, but it's not the wisest choice.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    35

    Re: Request was aborted? (SSL/TLS)

    Quote Originally Posted by Sitten Spynne View Post
    I don't think that error has anything to do with HTML Agility pack. SSL/TLS has to do with creating an HTTPS connection, which means it has more to do with how you're connecting to the site to download the HTML.

    What's your Windows version? How are you getting the HTML? Are you by chance using Mono instead of the .NET Framework? There's a lot of reasons you may be failing to establish this connection. But there's also this:



    This raises the possibility that the site's certificates are expired, which indicates the connection isn't as secure as it could be, which tends to cause .NET's networking to die. You can get around it, but it's not the wisest choice.
    Hey, thanks for the reply.

    I have changed nothing over the months that i have been working on it, everything was running fine then suddenly it has stopped working. Still using .net framework etc. I checked the sites SSL with an online checker and it says there is 556 days left on the sites certificate?

    I don't want to recreate this program using the web-browser control and regex to pull the data :/ What would be the easy way around the issue?

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,474

    Re: Request was aborted? (SSL/TLS)

    If you browse direct to the url do you get any errors? Also what did you use to check the site's certificate?

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    35

    Re: Request was aborted? (SSL/TLS)

    Quote Originally Posted by PlausiblyDamp View Post
    If you browse direct to the url do you get any errors? Also what did you use to check the site's certificate?
    Hi,

    no there are no other errors when i manually load the site up.

    Someone used the following and it worked


    when i try the above i get the error still.
    Last edited by lynx2011; Apr 26th, 2017 at 08:48 AM.

  6. #6
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,335

    Re: Request was aborted? (SSL/TLS)

    Can you change your .NET Framework target?

    Seems to work OK with 4.6 or above.

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    35

    Re: Request was aborted? (SSL/TLS)

    Quote Originally Posted by Inferrd View Post
    Can you change your .NET Framework target?

    Seems to work OK with 4.6 or above.
    Yeah that seemed to work, why would it all of a sudden stop working thou? it's puzzled me?

    also, i got it working using the following

    Code:
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

  8. #8
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,335

    Re: Request was aborted? (SSL/TLS)

    Quote Originally Posted by lynx2011 View Post
    Yeah that seemed to work, why would it all of a sudden stop working thou?
    Maybe the website recently changed it's security policy to only support the Tls1.2 protocol. Your guess is as good as mine.

    .Net 4.6 and above supports Tls1.2 by default. I believe that with .Net 4.5 you have to opt in to using it by using code such as you posted above.

    With versions of .Net prior to 4.5, it gets more complicated (at least for me )

  9. #9

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    35

    Re: Request was aborted? (SSL/TLS)

    Ah ok that makes sense, thanks for the help!

  10. #10
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: [Resolved] Request was aborted? (SSL/TLS)

    Experts: pay attention to this thread. There's some big regulation or another that's forcing a lot of servers to stop supporting TLS 1.0 in 2017. I've had to do a lot of work on our project to make sure we can support TLS 1.2, which is a sticky situation on Android 4.4 and earlier. (That's why I asked so many questions about platform earlier.)

    It's important to know that #7 has a fix, and Inferrd has an explanation in #8, and that things might be more complicated in earlier versions of the .NET Framework.

    (Also: TLS is hideously broken in Mono until about 4.8, and if you're using Xamarin you need to be using versions released February 2017 or later and you might need to change your project settings to avoid the default TLS implementation. If you're on Mono earlier than 4.8, you can use the ModernHttpClient package, but on Android it doesn't use TLS 1.2 on any version earlier than 5.0.)
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width