Help please!
I am having trouble to use serverxmlhttp & winhttp from ASP.net,
although in the
same web application my asp code works fine. I just can't figure out
why.
asp(using jscript):
var httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP");
var clientCertificate = "cert";
try
{
httpRequest.open("POST", this.serverUrl, false);
// send request to server
httpRequest.setOption(3) = clientCertificate;
httpRequest.send(requestXml);
....
C#:
ServerXMLHTTP adnConn = new ServerXMLHTTPClass();
try
{
adnConn.open("POST",serverUrl,false,null,null);
adnConn.setOption(MSXML2.SERVERXMLHTTP_OPTION.SXH_OPTION_SELECT_CLIENT_SSL_CERT,
"cert");
adnConn.send(requestXml);
The C# code always generate a exception called "security error". In
event viewer I can see a logged system error from Schannel, event id
36870. The detail is "A fatal error occurred when attempting to access
the SSL client credential private key. The error code returned from
the cryptographic module is 0xffffffff. "
I wrap the piece of C# code into a console application, login as
either iUSR or IWAM, and have no trouble. Therefore, I believe the
client certificate is ok, otherwise the asp and the console app won't
work.
I aslo believe there must be something wrong when iis runs the asp.net
application. However, I am unable to figure it out.
Any suggestions?