为什么用GetResponse取网页内容,但是取不到?
用的是msdn中的代码,但是发现,有的个别的https的网站取回的内容是空,状态是返回200。
取一般的例如www.163.com之类的网站内容没问题。
' Create a request for the URL.
Dim request As WebRequest = WebRequest.Create("https://www.abcd.com.cn/app/efg.jsp")
' If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials
' Get the response.
Dim response As WebResponse
response = request.GetResponse()
' Display the status.
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
Console.WriteLine("-----------------------------------------------------------------------------------------------------")
' Get the stream containing content returned by the server.
Dim dataStream As Stream = response.GetResponseStream()
' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
Console.WriteLine(responseFromServer)
' Clean up the streams and the response.
reader.Close()
response.Close()