I am trying to test my MVC3 Api which we build without using WebApi , We use normal MVC3 controllers to return an Xml data. Below is the code for the client . The certpath contains a abc.crt file .
// create certificate
var cert = new X509Certificate2(_settings.ApiSslCertPath);
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
var request = (HttpWebRequest)WebRequest.Create(_settings.AppUrl + "/api/GetContractsById/" + contractId);q
request.ClientCertificates.Add(cert);
request.Method = "GET";
var response = (HttpWebResponse)request.GetResponse();
Now when this request hits the Api , I am checking if the cert is present but its always false.
HttpContext context = System.Web.HttpContext.Current;
if (context.Request.ClientCertificate.IsPresent)
My WebConfig has
<access sslFlags="SslNegotiateCert"/>
and the IIS ha ...
Go to the complete details ...