.Net core upgrade for non interactive login

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Linus
    Junior Member
    • Jul 2024
    • 2

    #1

    .Net core upgrade for non interactive login

    Hi, I would like to check if there is a y clue why login failed with Cert_auth_Required after upgrading the non interactive login sample from .Net 4.8 to .Net core? the only thing changes is to replace the obsolete class to HttpClient class. It works probably before upgrade, and just got the issue after this changes. I m sure the cert together with the login credentials are correct. I also search from the forum, seems similar issue also encountered by others but so far I cannot find any resolution posted. Is that Betfair exchange API not supporting request from .Net core?
    appreciate if you could share some insights to me. I believe it is not my own problem

    Cheers,
    Linus
  • Redeniol
    Junior Member
    • Sep 2024
    • 2

    #2
    .NET Core uses a different way to manage HTTP requests and certificates compared to .NET Framework. It's possible that the way you are attaching the certificate to the HttpClient request might not be functioning as expected. Ensure that you are attaching the client certificate to the HttpClientHandler correctly in .NET Core. Here's an example of how to attach a certificate:
    HTML Code:
    var handler = new HttpClientHandler();
    handler.ClientCertificates.Add(new X509Certificate2("path_to_cert.p12", "cert_password"));
    
    var client = new HttpClient(handler);
    var response = await client.GetAsync("https://api.betfair.com/exchange");
    
    // Handle response...
    ​

    Comment

    Working...
    X