1个回答
展开全部
在ASP.NET中直接用Write()就可以了,代码如下 (.aspx.cs文件):
Response.Clear();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("content-disposition", "attachment;filename=" + filename+ ".txt;");
Response.Write("1234|ABCDE\r\n");
// 读取数据库,循环
for(i=0;i<100;i++)
{
Response.Write("1234|ABCDE\r\n");
}
Response.Flush();
Response.End();
Response.Clear();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("content-disposition", "attachment;filename=" + filename+ ".txt;");
Response.Write("1234|ABCDE\r\n");
// 读取数据库,循环
for(i=0;i<100;i++)
{
Response.Write("1234|ABCDE\r\n");
}
Response.Flush();
Response.End();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询