private string GetGeneralContent(string strUrl) { string strMsg = string.Empty; try { WebRequest request = WebRequest.Create(strUrl); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")); strMsg = reader.ReadToEnd(); reader.Close(); reader.Dispose(); response.Close(); } catch { } return strMsg; }
//读取文件,以gb2312编码 StreamReader sr = new StreamReader(fileload.PostedFile.InputStream, System.Text.Encoding.GetEncoding("gb2312")); string strTitle = sr.ReadLine();//读取每行数据