protected void lnkfilepath_Click(object sender, EventArgs e)
{
string filename = lnkfilepath.Text;
string Filpath = Server.MapPath("~/Attachments/" + filename);
DownLoad(Filpath);
}
public void DownLoad(string FName)
{
string path = FName;
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
else
{
Response.Write("This file does not exist.");
}
}
Can u use this above code..its support all types of file downloading
Reference Click Here