0
Reply

Download File

Amudha Vallee

Amudha Vallee

Jan 20 2006 2:37 AM
1.7k
Here is the code to download the files using C#
string path=Server.MapPath(FileName);
FileInfo file=new 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();
}