【发布时间】:2016-12-02 14:24:44
【问题描述】:
我正在使用此代码下载文件,但它会引发错误。请帮我处理一下。
线程被中止。
protected void Download_Click(object sender, EventArgs e)
{
try
{
string filePath = Convert.ToString(Attachment);
string fullFilePath = ("../../SiteImages/" + "donald.jpg");
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(fullFilePath) + "\"");
Response.ContentType = ContentType;
Response.TransmitFile(fullFilePath);
//MngLogs.InsertAuditsInfo("Tender downloaded via" + " " + MngLogs.PageName, MngLogs.UserMacAddress, MngLogs.UserIPAddress, UserID, "Download");
//Response.End();
}
catch (Exception ex)
{
Utility.Msg_Error(Master, ex.Message);
}
}
【问题讨论】:
-
是同一个地方,我删除了它,但它仍然没有下载文件
-
并且不会抛出错误但仍然不会下载文件
标签: c# asp.net multithreading webforms transmitfile