问题已经解决 是因为我访问的是https 它要求我与服务器之间建立信任关系。 那个例外 基础连接已经关闭: 无法与远程服务器建立信任关系 The underlying connection was closed: Could not establish secure channel for SSL/TLS
这个时候解决的方法先用: public class AcceptAllCertificatePolicy : ICertificatePolicy { public bool CheckValidationResult(ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, WebRequest request, int certificateProblem) { // Just accept. return true; } } ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
WebResponse response1 = request1.GetResponse(); 在GetResponse()中挂了。
我在家用adsl不存在局域网的问题吧。 我查了些资料, 说是有可能是ie的连接设置的问题。 但是我在ie连接中根本就没有设置局域网的东西啊。
还有 net_lover(孟子E章) 大哥给的东东确实有用, 不过现在还是没有解决俺的这个问题。 麻烦大家能否提供另外的方法来获得reesponse的内容
The underlying connection was closed: Could not establish secure channel for SSL/TLS
这个时候解决的方法先用:
public class AcceptAllCertificatePolicy : ICertificatePolicy
{
public bool CheckValidationResult(ServicePoint srvPoint,
System.Security.Cryptography.X509Certificates.X509Certificate
certificate,
WebRequest request,
int certificateProblem)
{ // Just accept.
return true;
}
} ServicePointManager.CertificatePolicy = new
AcceptAllCertificatePolicy();