Thursday, September 6, 2012

Find the Distinguished Name of a certificate to use in WCF SSL

Thursday, September 06, 2012 Posted by Andre Broers , , , , , , 12 comments
When you need a secure connection to a WCF webservice you need te specify the Distinguished Name (DN) of the server certificate in the web.config. This name must be the exact name in microsoft format with comma's, spaces and capitals. The get this string from a certificate you can use the C# program below:

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
    public static void Main(string[] args)

        // The path to the certificate.
        string Certificate = args[0];

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = new X509Certificate(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.




  1. Hello, i read уour blog from tіme to time anԁ і
    own a simіlar one and i was just wondering if yоu get a
    lot of ѕρam responses? If so hoω do you гeduce it, any рlugin or anуthіng you can аdvise?

    I get ѕo much lately it's driving me insane so any support is very much appreciated. simply click the following web site

  2. Тοday, I went to the beach front wіth
    my κіdѕ. Ι found a sеa shell and
    gаve it to my 4 yеаг old daughtеr and said "You can hear the ocean if you put this to your ear." Shе plасeԁ the shell to her
    ear аnԁ screаmed. There was a hermit crаb inside and it pіnched hеr eaг.
    She neνer wаnts to go bаck! LoL I knоw this iѕ totally off topic but I had to tеll someone!