The following to achieve this function is to use asp.net based on the data content to automatically generate a TXT text file and provide users to download, this method file does not exist on the server, directly provided to the user to download, to the online search, are used Response.BinaryWrite (), with a few, Found that there is a problem in IE, look at the page source code data is out, Firefox is a pop-up box to download, but not txt, but ASPX, inside the content is taken out of the database from the data.
In fact, in asp.net directly with write () on it, the code is as follows (. aspx.cs file):
Response.Clear ();
Response.Buffer = false;
Response.ContentType = "Application/octet-stream";
Response.appendheader ("Content-disposition", "attachment;filename=" + filename+ "TXT;");
Response.Write ("1234| abcde/r/n ");
Read database, loop
for (i=0;i<100;i++)
{
Response.Write ("1234| abcde/r/n ");
}
Response.Flush ();
Response.End ();
In IE and Firefox debugging through
This article is from: it knows Net (http://www.itwis.com) detailed source reference: http://www.itwis.com/html/net/aspnet/20081016/2599.html