J
Jerome
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
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