Response.Clear();
Response.Buffer = true;
//attachment表示作为附件下载,可改为online打开
//filename为指定输出文件的名称,注意扩展名的一致
Response.AppendHeader("Content-Disposition","attachment;filename=user.txt");
//Response.ContentType指定文件类型 可以为application/ms-excel
/*
导出时会弹出对话框让你确认保存位置
你可以选择保存,也可以直接打开
*/
// Response.ContentType = "web/vnd.ms-word";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//设置要显示的字和内容要保存的形式
Response.Charset = "txt文档";
this.EnableViewState = false;
Response.Buffer = true;
//attachment表示作为附件下载,可改为online打开
//filename为指定输出文件的名称,注意扩展名的一致
Response.AppendHeader("Content-Disposition","attachment;filename=user.txt");
//Response.ContentType指定文件类型 可以为application/ms-excel
/*
导出时会弹出对话框让你确认保存位置
你可以选择保存,也可以直接打开
*/
// Response.ContentType = "web/vnd.ms-word";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//设置要显示的字和内容要保存的形式
Response.Charset = "txt文档";
this.EnableViewState = false;