1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
X509Certificate Cert = new X509Certificate("C:\\MonDossier\\MonSousDossier\\MonCertificat.pem", "MaClefPrivee");
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("https://service.serveurdistant.com/projet/application/service/create.php");
Request.ClientCertificates.Add(Cert);
Request.Method = "POST";
Request.KeepAlive = true;
Request.AllowAutoRedirect = true;
Request.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequired;
ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
};
string __urlProxy = "http://192.168.15.98:9090";
string __proxyLogin = "monLoginProxy";
string __proxyPwd = "monMotDePasseProxy";
WebRequest.DefaultWebProxy = new WebProxy(__urlProxy, false, null, new NetworkCredential(__proxyLogin, __proxyPwd));
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
StreamReader __streamReader = new StreamReader(Response.GetResponseStream(), Encoding.Default);
__result = __streamReader.ReadToEnd();
__streamReader.Close(); |
Partager