Re: ASP.NET / certificat

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 01/26/05


Date: Wed, 26 Jan 2005 09:13:18 -0600

This sounds like the standard problem of not being able to access the
private key for the certificate from the current process. This is probably
a result of it being installed in the user's certificate store. Have you
tried installing it in the machine store?

Joe K.

"Jerome" <Jerome@discussions.microsoft.com> wrote in message
news:D0E2FEEA-7724-4A29-B4D9-6186232DD8FE@microsoft.com...
> Hi all
>
> I'm trying to access to a virtual directory (web server is a IIS 6.0 on
> Windows 2003 server) which requires client
> certificate with HttpWebRequest class.
> Simplified function code looks like this:
>
> HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
> httpWebRequest.ClientCertificates.Add(X509Certificate.CreateFromCertFile(@"c:\dada.cer"));
> httpWebRequest.Method = "POST";
> httpWebRequest.ContentLength = requestData.Length;
> Stream streamWriter = (httpWebRequest.GetRequestStream());
> streamWriter.Write(requestData,0,requestData.Length);
> streamWriter.Flush();
> streamWriter.Close();
> HttpWebResponse httpWebResponse =
> (HttpWebResponse)httpWebRequest.GetResponse();
> StreamReader streamReader = new
> StreamReader(httpWebResponse.GetResponseStream());
>
> When I tried this function in .NET Windows form
> application (C#) it works OK. But if I try to call the same
> function inside .NET ASP application (IIS 5.1 on Windows XP pro) I get
> Exception "The
> remote server returned an error: (403) Forbidden." when I trying to get
> response
> (line: HttpWebResponse httpWebResponse =
> (HttpWebResponse)httpWebRequest.GetResponse();)
>
> How can I do to configure my environment to allow ASP.NET application
> access
> my virtual directory
> Thanks,
> Jerome



Relevant Pages