用同一个方法访问http的完全正常。。。
我也加了设置:
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)) //https请求
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(CheckValidationResult);
myRequest = WebRequest.Create(url) as HttpWebRequest;
myRequest.ProtocolVersion = HttpVersion.Version11;
}
...
private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true; //总是接受
}
每次在Stream newStream = myRequest.GetRequestStream();这句的时候就异常,实在找不到原因了!
post连接:https://112.74.109.190/tniol-api/pos/login
post数据:user_name=sapi&password=123
哪位大神帮忙看看呀