Introduction
Here we will describe the simple way that you will use to make a request to one page of type SSL from C#, using HttpWebRequest class.
Taking as refence the article published in the web : http://msdn2.microsoft.com/en-us/library/aa720131(VS.71).aspx .
Content
The first we must do is generate one class that implement the IcertificatePolicy interface, the class will have the next form :
"cs">
public class MyPolicy : ICertificatePolicy
{
public bool CheckValidationResult(
ServicePoint srvPoint
, X509Certificate certificate
, WebRequest request
, int certificateProblem)
{
return true;
}
}
Next, to use this class we must write next text line :
"cs">
System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
This call will be do before of the instance of the HttpWebRequest class. Before run the application, you must modify the machine.config file, this is in the
%WINDIR%\Microsoft.NET\Framework\v1.1.4322\CONFIG directory.
The modifications are :
Find the node called servicePointManager and modify the value of the checkCertificateName attribute , this have the value in true by default and you must change this value to false. Then this node will look like this :
"xml"><servicePointManager checkCertificateName="false" checkCertificateRevocationList="false"/>
|
Refer to multipart_request_C_.asp for example.