I basically want a button that downloads files. I have the following code:
protected void downloadButton_Click(object sender, ImageClickEventArgs e)
{
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "filename=" + "abcd.txt");
Response.TransmitFile(Server.MapPath("~/Uploads/Group/") + "abcd.txt");
Response.End();
}
But nothing happens when I click it, and I get the following text in the output:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
The thread '<No Name>' (0x19d0) has exited with code 0 (0x0).
The thread '<No Name>' (0x1efc) has exited with code 0 (0x0).
I have the file "abcd.txt" in "Uploads/Group/" and I want to download it. What am i doing wrong?