Download File

Jan 20 2006 2:37 AM
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();
}