public class HtmlWriteFile { public HtmlWriteFile() { } public static bool createHtml(string[] strnewsHtml, string[] stroldHtml, string strModeFilePath, string strPath) { bool flag = false; StreamReader sr = null; StreamWriter sw = null; string filepath = HttpContext.Current.Server.MapPath(strModeFilePath); Encoding code = Encoding.GetEncoding("gb2312"); string s = string.Empty; try { sr = new StreamReader(filepath, code); s = sr.ReadToEnd(); } catch (Exception ex) { throw ex; } finally { sr.Close(); } try { for (int i = 0; i < strnewsHtml.Length; i++) { s = s.Replace(stroldHtml[i], strnewsHtml[i]); }