Sending POST Request using .NET HttpClientClass

i am trying to send a CSV File with http POST by means of the .NET framework. Having consulted various threads here, foremost “send rest-request with attached pfx certificate” i always end up with the receiving party answering with status code 401 “unauthorized”.

I have provided the receiving institution with the public part of an client certificate issued only for them. I exported the certificate from my local machine as .pfx file, including the private part.
In the first version of my program i apparently made the mistake to only attach the public part of the certificate. (Statement by the receiving party after asking them to check my incoming messages).
But now, having exported the certificate including the private part, i dont understand anymore what the problem is.
The URL which i am sending i checked with the receiving party, it is correct.

Here´s my main program:

                handler = new HttpClientHandler();
            handler.ClientCertificateOptions = ClientCertificateOption.Manual;
            handler.SslProtocols = SslProtocols.Tls12;
            handler.ClientCertificates.Add(new X509Certificate(_cnf_CertificateLocalPath, "thepassword"));
            
            fs = new FileStream(_cnf_FileToTransfer, FileMode.Open);
            sr = new StreamReader(fs, Encoding.Default);
            fileContent = sr.ReadToEnd();
            sr.Dispose();
            fs.Dispose();
            

            Task mytask = Upload(handler, fileContent, "myfile.csv");
            System.Threading.Thread.Sleep(5000);
            currentTimestamp = DateTime.Now.Year.ToString() + "_" +
                               DateTime.Now.Month.ToString().PadLeft(2, '0') + "_" +
                               DateTime.Now.Day.ToString().PadLeft(2, '0') + "_" +
                               DateTime.Now.Hour.ToString().PadLeft(2, '0') + "_" +
                               DateTime.Now.Minute.ToString().PadLeft(2, '0') + "_" +
                               DateTime.Now.Second.ToString().PadLeft(2, '0') + "_" +
                               DateTime.Now.Millisecond.ToString().PadLeft(3, '0');

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("end of program run at {0}", currentTimestamp);
            

            //Console.WriteLine("==> end of program run");
            Console.WriteLine("==> press any key to close window");
            Console.ReadLine();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
            Console.ReadLine();
        }

And here the Upload Method itself:

        public static async Task Upload(HttpClientHandler handler, string parmInFileContent, string fileName)
    {

        using (var client = new HttpClient(handler))
        {
            using (var content =
                new StringContent(parmInFileContent, Encoding.UTF8, "text/csv"))
            {
                using (
                   var message =
                       await client.PostAsync(_API_URL, content))
                {
                    if (message.IsSuccessStatusCode)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                    }

                    Console.WriteLine(message.Content.ToString());
                    Console.WriteLine(message.StatusCode.ToString());
                    Console.WriteLine(message.ToString());
                    Console.WriteLine(message.Headers.Warning.ToString());
                }
            }
        }
    }

I suspect that i am doing something wrong when generating the .pfx file. Regarding the program structure itself there seems not to be much of a choice, but i am not sure.

Any help would be appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật