我正在使用此代码下载文件,但它会引发错误。请帮助我处理它。
威胁已经被清除了。
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);
}
}