Discussion:
mapping certificates programatically c#
(too old to reply)
Krishna
2007-05-31 01:00:21 UTC
Permalink
I am trying to map client certificates automatically using WMI and C#
in my web service application.
I understand that there is a IIsCertMapper class, but i am totally
lost like how to create/get an object of this class.
i tried using DirectoryServices namespace but was unsucessful. now i
am trying with System.Management namespace, but i am kind of lost.
can someone help me.

thanks
krishna.
Krishna
2007-06-01 21:06:52 UTC
Permalink
Post by Krishna
I am trying to map client certificates automatically using WMI and C#
in my web service application.
I understand that there is a IIsCertMapper class, but i am totally
lost like how to create/get an object of this class.
i tried using DirectoryServices namespace but was unsucessful. now i
am trying with System.Management namespace, but i am kind of lost.
can someone help me.
thanks
krishna.
I was able to figure it out although not completely. For anyone
interested here is a small code snipet in C#.

DirectoryEntry iisAdmin = new
System.DirectoryServices.DirectoryEntry("IIS://MYSERVER/W3SVC/1/
IIsCertMapper");

X509Certificate cert =
X509Certificate.CreateFromCertFile("myCertificateFile.cer");

byte []certHash = cert.GetRawCertData();

iisAdmin.Invoke("CreateMapping", new object[] { certHash, "DOMAIN\
\Username", "password", "mapping namae", true });


thanks,
krishna.

Loading...