代码改变世界

导出文件

2010-12-02 16:34  hailibu  阅读(172)  评论(0编辑  收藏  举报

protected void Button3_Click(object sender, EventArgs e)
{
    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("Content-Disposition", "attachment;filename=ExportFile.txt");
    Response.ContentType = "text/plain";//application/ms-excel,application/ms-word,application/ms-html
    Response.Write("内容");
    Response.End();
}