I have uploaded my file and inserted its data into database, now when i click I want to download it.
bytes = (byte[])dsResult.Tables[0].Rows[0]["data"];
contentType.Text = dsResult.Tables[0].Rows[0]["contentType"].ToString();
fileName.Text = dsResult.Tables[0].Rows[0]["name"].ToString();
try
{
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = contentType.Text;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName.Text);
Response.BinaryWrite(bytes);
Response.Flush();
}
catch (Exception ex)
{
throw;
}
It's not throwing any error but it is not downloading file.