Cant make HTTPS POST Request due to certificates error

Cant make HTTPS POST Request due to certificates error

BY 01 Apr 2019 Tizen .NET
            .
    		.
			.
			
			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.

 

Written by