我試圖用C#獲取代碼中的網頁內容,但它給了我錯誤。請幫我解決它。使用c讀取網站內容時出現錯誤#
string url = "http://www.abesoft.org/query.asp
searchtype=ANY&
query_param=USDOT&original_query_param=NAME&
query_string=2134430&original_query_string=NATIONAL GRASS LLC";
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();
Stream data = response.GetResponseStream();
string html = String.Empty;
using (StreamReader sr = new StreamReader(data))
{
html = sr.ReadToEnd();
}
錯誤 - "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
我認爲這個問題是該網站需要/想要一個安全連接... – Marco
你確定這是此代碼正確的錯誤?你正在使用'http',而不是'https'? – Oded
錯誤是相同的,如果我使用https – Pankaj