程序假死
批量读取网页原文件时程序假死, 是不是要用多线程
Public Shared Function getHttpXml(ByVal mn As String) As String
Dim url As String = "http://www.123.com?mn=" & System.Web.HttpUtility.UrlEncode(mn, System.Text.UnicodeEncoding.GetEncoding("GB2312"))
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpReq.ContentType = "text/html; charset=utf-8"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与 Internet 资源建立持久连接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding("GB2312"))
Return reader.ReadToEnd()
End Function