Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.txt"); Response.Charset = "gb2312"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.ContentType = "application/vnd.txt"; StringBuilder sb = new StringBuilder(Regex.Replace(mobiles, ",", "\r\n")); System.IO.StringWriter stringWrite = new System.IO.StringWriter(sb); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); Response.Write(stringWrite.ToString()); Response.End();