How to be right?

HttpWebRequest request = WebRequest.Create("https://10.220.83.1:4848") as HttpWebRequest; request.AuthenticationLevel = AuthenticationLevel.None; CookieContainer cookies = new CookieContainer(); request.CookieContainer = cookies; NetworkCredential myCred = new NetworkCredential("", "", ""); CredentialCache myCache = new CredentialCache(); myCache.Add(new Uri("https://10.220.83.1:4848"), "Basic", myCred); request.Credentials = myCache; HttpWebResponse response = request.GetResponse() as HttpWebResponse; 
  • one
  • there is nothing said about the httpS protocol, but I need it, how to read it via http I know. - YGOR-CHAMIN
  • and what's the difference then? ... ssl you need to connect the certificate, everything else seems to also be on stackoverflow.com/questions/560804/… - JEcho
  • but where can I get it if the site of the google.ru example is YGOR-CHAMIN

1 answer 1

It was a self-signed certificate. There are no problems with a trusted certificate. Example for self-signed certificates:

 public static bool ValidateServerCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } private void button2_Click(object sender, EventArgs e) { HttpWebRequest request = WebRequest.Create("https://ваш адрес") as HttpWebRequest; ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; HttpWebResponse response = request.GetResponse() as HttpWebResponse; }