日期:2014-05-16 浏览次数:21360 次
String value = "This is the test value"; //你也可以读取文件内容到value变量
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("CONTENT-LENGTH", value.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=download.txt");
Response.CacheControl = "public";
Response.Write(value);
Response.Flush();