【发布时间】:2019-06-11 22:03:46
【问题描述】:
由于我的网站使用 ssl 证书,我无法再从我的服务器访问 xml 文件。请帮帮我。
我有来自 ZeroSSL 页面的 4 个文件: 帐户密钥.txt; (RSA 私钥) 域-csr.txt; (CRT) (CABUNDLE) 2OmkvG1CfXtJ-sYpp5mV0……; (文件 没有扩展)qGGRddmOl62soMPdlCBeamnR......; (文件没有 扩展名)
网址现在以https开头,我目前的代码是:
string currentVersion = GetWebPage("http://sofobot.com/version.xml");
XmlDocument VersionInfo = new XmlDocument();
VersionInfo.LoadXml(currentVersion);
.
.
public static string GetWebPage(string URL)
{
System.Net.HttpWebRequest Request = (HttpWebRequest)(WebRequest.Create(new Uri(URL)));
Request.Method = "GET";
Request.MaximumAutomaticRedirections = 4;
Request.MaximumResponseHeadersLength = 4;
Request.ContentLength = 0;
StreamReader ReadStream = null;
HttpWebResponse Response = null;
string ResponseText = string.Empty;
Response = (HttpWebResponse)(Request.GetResponse());
Stream ReceiveStream = Response.GetResponseStream();
ReadStream = new StreamReader(ReceiveStream, System.Text.Encoding.UTF8);
ResponseText = ReadStream.ReadToEnd();
Response.Close();
ReadStream.Close();
return ResponseText;
}
en System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) en System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResultlazyResult) en System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) zh System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult 结果) zh System.Net.TlsStream.Write(Byte[] 缓冲区,Int32 偏移量,Int32 大小) zh System.Net.ConnectStream.WriteHeaders(布尔异步)
【问题讨论】:
-
您遇到什么错误?证书有效吗? (如果您在 Web 浏览器中访问该 url,它是否显示为有效的 https 连接)
标签: c# ssl https certificate ssl-certificate