2012-08-22 3 views
2

내가 잘못된 인증서가있는 웹 페이지를 요청하는 마이크로 소프트의 WinHttpRequest COM 개체를 사용하고 있습니다 : Send에 대한 호출이 제외IWinHttpRequest로 잘못된 인증서를 무시하는 방법?

IWinHttpRequest http = new WinHttpRequest(); 
http.Open("GET", url, false); 
http.Send(null); 

하면 예외가 발생합니다 :

0x80072F0D - The certificate authority is invalid or incorrect 

가 어떻게 WinHttpRequest을 말할까요을 그 나는 상관 없어, 나는 그것을 요청한 페이지를 검색하고 싶습니까?

답변

6

이 솔루션은 four kinds of SSL errors을 무시하는 것입니다

IWinHttpRequest http = new WinHttpRequest(); 
http.Open("GET", url, false); 

//ignore all SSL errors 
http.Option[WinHttpRequestOption_SslErrorIgnoreFlags] = 0x3300; 
    //Unknown certification authority (CA) or untrusted root 0x0100 
    //Wrong usage            0x0200 
    //Invalid common name (CN)         0x1000 
    //Invalid date or certificate expired      0x2000 

http.Send(null); 

: 모든 코드는 퍼블릭 도메인으로 배포됩니다. 기여가 필요하지 않습니다.

관련 문제