Languages

Menu
Sites
Language
Cant make HTTPS POST Request due to certificates error
            .
    		.
			.
			
			var request = new HttpRequestMessage();
            var mediaType = "application/x-www-form-urlencoded";
            try
            {
                using (var httpClientHandler = new HttpClientHandler())
                {
                    httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
                    using (var httpClient = new HttpClient(httpClientHandler))
                    {
                        request = new HttpRequestMessage(method, url)
                        {
                            Content = new FormUrlEncodedContent(data)
                        };
                        request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(mediaType));
                        HttpResponseMessage response = new HttpResponseMessage();
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                        {
                            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
                        }
                        response = await httpClient.PostAsync(request.RequestUri, request.Content);
                    }
                }
            }
			catch(Exception e)
			{
			.
			.
			.

Hello, 

As a new developer I am trying to create a simple .net wearable widget that will make an https post request. 

Throught the emulator I am not facing any problems but through my galaxy watch it seems that it throws the following exception.

Access to the path '/opt/usr/home/owner/.dotnet/corefx/cryptography/x509stores/ca' is denied. .

I am also attaching the code snippet that throws the exception. As you can see, I attempted to ignore the validation error but nothing happens.

Regarding the privileges I have added the internet privilege. 

Thanks.

 

Responses

7 Replies
Juwon(Julia) Ahn

Hello,

Could you let us know the page(resource) url that you want to access? We'll test it.

Dimitris Petridis

It is about a private url and I do not want to expose this kind of infmation publically.

However, If you want to test it I have also checked with a dummy https post request and I received the same response. 

Edit: As the external linkes are not permitted , please add the htttps://   to the text of the next line in order to make the full url. 

jsonplaceholder.typicode.com/posts

Dimitris Petridis

I made a mistake, using the above url it worked properly. It seems that my url is not well certified by a certificate authority and this is the reason why I am receiving the "Access to the path '/opt/usr/home/owner/.dotnet/corefx/cryptography/x509stores/ca' is denied."  So my question now is, is there any way to ignore the certficate verfication? 

Juwon(Julia) Ahn

Hello Dimitris Petridis,

Unfortunately, there's no way to ignore it. 
Why don't you try to use the HttpWebRequest with client certificates for authentication?
I hope that it will solve the problem. If you can't resolve it, please send us an email to tizen.net@samsung.com.
We can check it if you can share URL info with us by email.

Juwon(Julia) Ahn

Hello Dimitris Petridis,

"Access to the path '/opt/usr/home/owner/.dotnet/corefx/cryptography/x509stores/ca' is denied." 

We are going to apply the patch to solve this issue.  I'm trying to get an estimated schedule for this patch.

As soon as I get any further info, I'll let you know.

Thanks.

 

Sina Labbaf

Do you have any solution yet? Or any work arounds?

Tizen .NET

As far as I know, this patch has been applied to some of Galaxy Watch models.
It will be applied to all models based on Tizen 5.5.
Thanks.