The remote server returned an error: (409) Conflict.

WebSpider 76 Reputation points
2021-07-31T10:10:10.527+00:00

Hi guys. I'm using visual studio 2010 and i have installed framework 4.8 to my windows 7.

I've targeted to Framework 4.5 in web.config

<compilation debug="true" strict="false" explicit="true" targetFramework="4.5">

I got this error when i use the following code:
The request was aborted: Could not create SSL/TLS secure channel.

        Dim httpRequest As HttpWebRequest = DirectCast(WebRequest.Create(New Uri(EndpointUrl)), HttpWebRequest)
        httpRequest.Accept = "application/json"
        httpRequest.ContentType = "application/json"
        httpRequest.Method = "POST"

This error message returned when i added the following to my existing code:
The remote server returned an error: (409) Conflict.

    ServicePointManager.Expect100Continue = True
    ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)

    Dim httpRequest As HttpWebRequest = DirectCast(WebRequest.Create(New Uri(EndpointUrl)), HttpWebRequest)
    httpRequest.Accept = "application/json"
    httpRequest.ContentType = "application/json"
    httpRequest.Method = "POST"

I can use ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 which is not available in my VS2010.

Please advise. TQ

Developer technologies | .NET | .NET Runtime
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.