how do i fix this System error '80131509' The request was aborted: Could not create SSL/TLS secure channel. /webmain.asp, line 12670

Jill Johnson 0 Reputation points
2025-02-20T17:24:25.71+00:00

I am trying to get a fed ex shipping price from a website and this error comes up

System error '80131509'

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

/webmain.asp, line 12670

How do I fix it?

Developer technologies | ASP.NET | ASP.NET API
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 79,101 Reputation points Volunteer Moderator
    2025-02-20T22:48:45.3933333+00:00

    you don't give enough information. common causes are:

    • the called site is using a self signed certificate
    • the called site requires a higher TSL version then the caller supports
    • the called site requires a client certificate
    0 comments No comments

  2. Danny Nguyen (WICLOUD CORPORATION) 800 Reputation points Microsoft External Staff
    2025-07-17T08:51:11.4133333+00:00

    Hi,

    It seems that this is a SSL/TLS problem when making HTTPS requests to external APIs like FedEx.

    The probable causes could be:

    1. TLS Version Issues

    • Problem: Your server may be using an outdated TLS version
    • Solution: Ensure your code explicitly sets TLS 1.2 or higher
    // Add this before making any HTTPS requests
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
    

    2. Certificate Validation Problems

    • Problem: SSL certificate chain validation failing
    • Solutions:
      • Update Windows and .NET Framework
        • Install intermediate certificates
          • Temporarily bypass certificate validation (testing only):
    // Only for testing - NOT for production
    ServicePointManager.ServerCertificateValidationCallback = 
        (sender, certificate, chain, sslPolicyErrors) => true;
    

    3. Windows/Server Configuration

    • Check Windows Updates: Ensure latest security updates are installed
    • Enable TLS 1.2 in Registry (if Windows Server 2008 R2 or older):

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client] "DisabledByDefault"=dword:00000000 "Enabled"=dword:00000001

    4. FedEx API Specific Issues

    • Endpoint Changes: FedEx may have updated their API endpoints
    • Authentication: Verify your API credentials are still valid
    • Rate Limiting: Check if you're hitting API rate limits

    Here's how you can attempt to troubleshoot this problem:

    Step 1: Test Basic Connectivity

    try
    {
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        using (var client = new WebClient())
        {
            string result = client.DownloadString("https://www.fedex.com");
            Response.Write("Connection successful");
        }
    }
    catch (Exception ex)
    {
        Response.Write($"Error: {ex.Message}");
    }
    

    Step 2: Check TLS Configuration

    • Use online SSL checkers (SSL Labs) to verify FedEx endpoint requirements
    • Ensure your server supports the required TLS version

    Step 3: Update Your Code (Modern HttpClient approach)

    // Modern approach using HttpClient
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
    
    using (var client = new HttpClient())
    {
        client.DefaultRequestHeaders.Add("Content-Type", "application/xml");
        
        try
        {
            var content = new StringContent(xmlRequest, Encoding.UTF8, "application/xml");
            var response = await client.PostAsync("https://fedex-api-endpoint", content);
            
            if (response.IsSuccessStatusCode)
            {
                string result = await response.Content.ReadAsStringAsync();
                // Process result
            }
        }
        catch (HttpRequestException ex)
        {
            // Handle SSL/TLS errors
            Response.Write($"Request error: {ex.Message}");
        }
    }
    

    Step 4: Alternative with WebRequest

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    
    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://fedex-api-endpoint");
        request.Method = "POST";
        request.ContentType = "application/xml";
        
        using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
        {
            writer.Write(xmlRequest);
        }
        
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        using (StreamReader reader = new StreamReader(response.GetResponseStream()))
        {
            string result = reader.ReadToEnd();
            // Process result
        }
    }
    catch (WebException ex)
    {
        Response.Write($"Web exception: {ex.Message}");
    }
    

    Step 5: Check Server Environment

    • .NET Framework Version: Ensure you're running .NET 4.6+ for better TLS support
    • Windows Version: Older Windows versions may need registry changes
    • Firewall/Proxy: Verify no network restrictions

    Step 6: Implement Proper Error Handling

    try
    {
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        
        // Your FedEx API call here
        
    }
    catch (WebException ex)
    {
        if (ex.Status == WebExceptionStatus.SecureChannelFailure)
        {
            Response.Write("SSL/TLS Error: " + ex.Message);
            // Log additional details
        }
    }
    catch (Exception ex)
    {
        Response.Write($"General error: {ex.Message}");
    }
    

    Quick Fixes to Try

    1. Force TLS 1.2: Add ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; in Application_Start() or before API calls
    2. Update .NET Framework: Install latest version (4.8 recommended)
    3. Check FedEx Documentation: Verify current API endpoints and requirements
    4. Test with Postman: Confirm the API works outside your application
    5. Review Recent Changes: Check if FedEx updated their security requirements

    Hope this helps


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.