Skip to content

Load image randomly (?) throws WebException: "The request was aborted: Could not create SSL/TLS secure channel" #149

@schdck

Description

@schdck

Sometimes when loading an image from internet, a WebException would be thrown with the following message:

The request was aborted: Could not create SSL/TLS secure channel

I currently don't have another computer to test on, but on my machine the following snippet throws de exception 100% of time (maybe because the website does not support TLS 1.0 and/or 1.1?):

<htmlRenderer:HtmlPanel Text="&lt;html&gt;&lt;body&gt;&lt;img src=&quot;https://eleaut.com.br/imagens_assinatura/logo.png&quot; /&gt;&lt;/body&gt;&lt;/html&gt; " />

Apparently the error can be solved quite simply by adding the following line (taken from here):

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Or, since we are on .NET 3.0, this one:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

I'll do a PR as soon as I can :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions