private static string TextFromFile() { string sLine = ""; using (StreamReader objReader = new StreamReader(HttpContext.Current.Server.MapPath("Default.aspx"), System.Text.Encoding.Default)) { StringBuilder sb = new StringBuilder(); while ((sLine = objReader.ReadLine()) != null) { sb.AppendLine(sLine); } objReader.Close(); sLine = sb.ToString(); } return sLine; }
转载于:https://www.cnblogs.com/Setme/archive/2012/06/05/2537160.html