При попытке загрузить страницу
https://www.roseltorg.ru/auction/guiding/view_auction?id=25400 Возникает Exception:
The request was aborted: Could not create SSL/TLS secure channel.
Для загрузки пробовал использовать код с
http://mhinze.com/archive/consuming-web-services-crafting-webrequests-using-ssl-where-the-cert-is-expired-or-otherwise-hosed/
#pragma warning disable 612,618
ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy ();
#pragma warning restore 612,618
var req = WebRequest.Create(URI);
using (var myHttpWebResponse = (HttpWebResponse )req.GetResponse())
{}
internal class AcceptAllCertificatePolicy : ICertificatePolicy
{
public AcceptAllCertificatePolicy()
{
}
public bool CheckValidationResult(ServicePoint sPoint, X509Certificate cert, WebRequest wRequest, int certProb)
{
// Always accept
return true ;
}
}
Trace
System.Net Information: 0 : [3904] Current OS installation type is 'Client'.
System.Net Verbose: 0 : [3904] WebRequest::Create(
https://www.roseltorg.ru/auction/guiding/view_auction?id=25400)
System.Net Verbose: 0 : [3904] HttpWebRequest#9343929::HttpWebRequest(
https://www.roseltorg.ru/auction/guiding/view_auction?id=25400#660281608)
System.Net Information: 0 : [3904] RAS supported: True
System.Net Verbose: 0 : [3904] Exiting HttpWebRequest#9343929::HttpWebRequest()
System.Net Verbose: 0 : [3904] Exiting WebRequest::Create() -> HttpWebRequest#9343929
System.Net Verbose: 0 : [3904] HttpWebRequest#9343929::GetResponse()
System.Net Information: 0 : [3904] Associating HttpWebRequest#9343929 with ServicePoint#62841930
System.Net Information: 0 : [3904] Associating Connection#25220266 with HttpWebRequest#9343929
System.Net Verbose: 0 : [3904] HttpWebRequest#28269024::HttpWebRequest(
http://192.168.16.1:8080/#-54391078)
System.Net Verbose: 0 : [3904] Exiting HttpWebRequest#28269024::HttpWebRequest()
System.Net Information: 0 : [3904] Associating HttpWebRequest#28269024 with ServicePoint#721646
System.Net Verbose: 0 : [3904] HttpWebRequest#28269024::GetResponse()
System.Net Information: 0 : [3904] Associating Connection#41133837 with HttpWebRequest#28269024
System.Net Information: 0 : [3904] Connection#41133837 — Created connection from 192.168.16.38:39641 to 192.168.16.1:8080.
System.Net Information: 0 : [3904] Associating HttpWebRequest#28269024 with ConnectStream#62927341
System.Net Information: 0 : [3904] HttpWebRequest#28269024 — Request: CONNECT
www.roseltorg.ru:443 HTTP/1.1
System.Net Information: 0 : [3904] ConnectStream#62927341 — Sending headers
{
Host:
www.roseltorg.ru
Proxy-Connection: Keep-Alive
}.
System.Net Information: 0 : [3904] Connection#41133837 — Received status line: Version=1.1, StatusCode=200, StatusDescription=Connection established.
System.Net Information: 0 : [3904] Connection#41133837 — Received headers
{
Via: 1.1 TMG1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
}.
System.Net Information: 0 : [3904] ConnectStream#30088697::ConnectStream(Buffered -1 bytes.)
System.Net Information: 0 : [3904] Associating HttpWebRequest#28269024 with ConnectStream#30088697
System.Net Information: 0 : [3904] Associating HttpWebRequest#28269024 with HttpWebResponse#37334161
System.Net Verbose: 0 : [3904] Exiting HttpWebRequest#28269024::GetResponse() -> HttpWebResponse#37334161
System.Net Verbose: 0 : [3904] HttpWebResponse#37334161::GetResponseStream()
System.Net Information: 0 : [3904] ContentLength=-1
System.Net Verbose: 0 : [3904] Exiting HttpWebResponse#37334161::GetResponseStream() -> ConnectStream#30088697
System.Net Information: 0 : [3904] TlsStream#47672397::.ctor(host=
www.roseltorg.ru, #certs=0)
System.Net Information: 0 : [3904] Associating HttpWebRequest#9343929 with ConnectStream#32972095
System.Net Information: 0 : [3904] HttpWebRequest#9343929 — Request: GET /auction/guiding/view_auction?id=25400 HTTP/1.1
System.Net Information: 0 : [3904] SecureChannel#20592097::.ctor(hostname=
www.roseltorg.ru, #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [3904] Enumerating security packages:
System.Net Information: 0 : [3904] Negotiate
System.Net Information: 0 : [3904] NegoExtender
System.Net Information: 0 : [3904] Kerberos
System.Net Information: 0 : [3904] NTLM
System.Net Information: 0 : [3904] Schannel
System.Net Information: 0 : [3904] Microsoft Unified Security Protocol Provider
System.Net Information: 0 : [3904] WDigest
System.Net Information: 0 : [3904] TSSSP
System.Net Information: 0 : [3904] pku2u
System.Net Information: 0 : [3904] CREDSSP
System.Net Information: 0 : [3904] SecureChannel#20592097 — Left with 0 client certificates to choose from.
System.Net Information: 0 : [3904] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Information: 0 : [3904] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName =
www.roseltorg.ru, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [3904] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=115, returned code=ContinueNeeded).
System.Net Information: 0 : [3904] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 1cc7c2b0:1952148, targetName =
www.roseltorg.ru, inFlags = eplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [3904] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=AlgorithmMismatch).
System.Net Error: 0 : [3904] Exception in the HttpWebRequest#9343929:: — The request was aborted: Could not create SSL/TLS secure channel.
System.Net Error: 0 : [3904] Exception in the HttpWebRequest#9343929::GetResponse — The request was aborted: Could not create SSL/TLS secure channel.
Второй вариант из поста тоже падает.
Также пробовал способ способ из
http://www.gotdotnet.ru/forums/2/79403/377856/#post377856 , но выдает точно такая же ошибка . В трейсе пишет «Cannot find the certificate in either the LocalMachine store or the CurrentUser store» возможно из- за того что, что после добавления сертификата он не появляется Tools menu -> Internet Options -> Content tab -> Certificates utton -> Trusted Root Certification Authorities .
Как загружать данные по https c
https://www.roseltorg.ru/auction/guiding/view_auction?id=25400 ?
Так хочется опять стать бизнесменом, а что Вы уже были? Нет, но уже хотелось.
Так хочется опять стать бизнесменом, а что Вы уже были? Нет, но уже хотелось.
Если требуется сервером идентификация с помощью сертификата и вы его как-то не так установили или недоустановили — естественно что соединение не может быть установлено и из-за этого возникает ошибка