这是我的一段代码:
if (objTbl.Rows.Count > 0)
{
string attachment = "attachment; filename=Call-Details-Report-" + startDate.SelectedDate.Value.ToString("MM-dd-yyyy") + ".csv";
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "text/csv";
Response.AddHeader("Pragma", "public");
bool commaRequired = false;
if (this.chkNET_NETWORKID.Checked)
{
Response.Write("Network ID");
commaRequired = true;
}
if (this.chkNET_NETWORKNAME.Checked)
{
if (commaRequired)
{
Response.Write(",");
}
Response.Write("Network");
commaRequired = true;
}
}
在上面的代码中,objTbl是我的数据表。我从数据表中读取数据并将其写入响应并获取文件以供下载。但是当我尝试下载大文件时出现错误。
程序执行期间内存不足。我听说了response.transmit
。可以解决这个问题但是怎么解决?