Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1567

Blazor HTTPS client server certificate doesn't work

$
0
0

My Blazor client server solution took a lot of fussing to get the cert just to be recognized.

// These commands allow you to reset when needed//dotnet dev-certs https --trust//dotnet dev-certs https --clean//dotnet dev-certs https --check

This command:

dotnet dev-certs https --trust 

does not work and it's been a long time since it has worked.

It creates a cert, but puts it here (untrusted):

enter image description here

dotnet dev-certs https --check 

This shows up as untrusted.

This forces a S.O. Search:

dotnet dev-certs https --trust

It said: copy the certificate with the ASP.NET Core HTTPS development certificate friendly name by copying from Current User > Personal > Certificates into Current User > Trusted root certification authorities.

I don't think simply copying it works, you have to export and then import to the proper store.

This resulted in this:

The same cert moved into trusted root of (Local Computer)

This finally allowed the cert to be read and processed by this code:

Note in the using command below you will want this store: StoreName.Root,StoreLocation.LocalMachineand this:  509FindType.FindBySubjectName, "localhost"
X509Certificate2 GetCertificateFromStore(){    using (var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine))    {        store.Open(OpenFlags.ReadOnly);        PrintCertNames(store);        var certs = store.Certificates.Find(X509FindType.FindBySubjectName, "localhost", false);        if (certs.Count > 0)        {            var cert = certs[0];            if (IsCertificateTrusted(cert))            {                return cert;   // Cert is returned here.            }        }    }}

Now the app doesn't display at all. Any tips on what to check and how to check things? Note I have my firewall code set to off.


Viewing all articles
Browse latest Browse all 1567

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>