Client Certificates problem

Dean Cleaver <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <4543A775711185429E59B18055D4167423168B@sxslakl004.xceptionsoftware.com>
Hi,

I'm having a problem with client certificates - I can't get it to work.
Below is my code - the URL is valid, as is the certificate path. I've
viewed the certificate properties and it appears valid - yet I just get
"403 - Forbidden" when I try to connect. My provider made client
certificates mandatory last night, so I am very sure that this is the
problem.

Is there anything obvious I missed?

Dino


---------------------------
HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(url);
ServicePointManager.ServerCertificateValidationCallback =
this.ValidateServerCertificate;

X509Certificate certificate =
X509Certificate.CreateFromCertFile(fullPath);
httpWebRequest.ClientCertificates.Add(certificate);

// Set the 'Method' property of the 'Webrequest' to 'POST'.
httpWebRequest.Method = "POST";

// Set the content type of the data being posted.
httpWebRequest.ContentType = "multipart/form-data";

// Set the content length of the string being posted.
httpWebRequest.ContentLength = 0;

HttpWebResponse httpWebResponse;

try
{
        // Make the request
        httpWebResponse = (HttpWebResponse)
httpWebRequest.GetResponse();
}
catch (WebException)
{
    if (processing)
        throw;

    processing = true;
    Thread.Sleep(5000);
    return this.ProcessData(data, baseData);
}
catch (Exception ex)
{
        GC.KeepAlive(ex);
        throw;
}

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.