exception при попытке загрузить страницу по https {"The requ
От: ivinsky Беларусь ivinsky.livejournal.com
Дата: 12.07.10 14:34
Оценка:
При попытке загрузить страницу 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 ?
Так хочется опять стать бизнесменом, а что Вы уже были? Нет, но уже хотелось.
ssl webrequest
Re: exception при попытке загрузить страницу по https {"The
От: Jolly Roger  
Дата: 13.07.10 13:23
Оценка:
Здравствуйте, ivinsky, Вы писали:

Вероятно, что-то с прокси или его настройками. Он точно тунеллирование для HTTPS пропускает? Через IE с Вашего компьютера открывается?
"Нормальные герои всегда идут в обход!"
Re[2]: exception при попытке загрузить страницу по https {"T
От: ivinsky Беларусь ivinsky.livejournal.com
Дата: 13.07.10 14:56
Оценка:
JR>Вероятно, что-то с прокси или его настройками. Он точно тунеллирование для HTTPS пропускает? Через IE с Вашего компьютера открывается?
Да открывается. Проблема связанна с операционной системой, т.к. в windows XP код работает, а вот в 7-ке возникают проблемы.
Так хочется опять стать бизнесменом, а что Вы уже были? Нет, но уже хотелось.
Re: exception при попытке загрузить страницу по https {"The
От: Аноним  
Дата: 13.07.10 15:41
Оценка:
Если требуется сервером идентификация с помощью сертификата и вы его как-то не так установили или недоустановили — естественно что соединение не может быть установлено и из-за этого возникает ошибка
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.