이 코드를 사용하여 파일을 다운로드하고 있지만 오류가 발생합니다. 취급을 도와주세요.내 코드가 스레드에서 오류를 발생시키는 이유는 무엇입니까?
스레드가 중단되었습니다.
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);
}
}
어디서 오류가 발생 했습니까? 'Reponse.End()'는 항상'ThreadAbortException'을 던집니다. [this] (http://stackoverflow.com/questions/20988445/how-to-avoid-response-end-thread-was-being-aborted-exception-during-the-exce)와 [this]를보십시오. (http://stackoverflow.com/questions/5834049/what-causes-thread-was-being-aborted-exception-to-happen-at-random-and-showthth) post. –
예. 같은 위치에서 제거했지만 여전히 파일을 다운로드하지 않습니다. – Cuckoo
오류가 발생하지 않지만 여전히 파일을 다운로드하지 않습니다. – Cuckoo