1.ViewState["UpLoadFile"] = ds.Tables[0].Rows[0]["UpLoadFile"]!=System.Convert.DBNull?(byte[])ds.Tables[0].Rows[0]["UpLoadFile"]:null;
2.
Response.AddHeader("Connection", "Keep-Alive");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=" + ViewState["UpLoadFileName"].ToString());
Response.OutputStream.Write((byte[])ViewState["UpLoadFile"], 0, (int)(((byte[])ViewState["UpLoadFile"]).Length));
Response.End();