public static void DownLoadFile(HttpRequest _Request, HttpResponse _Response, string fileName, string fullPath) { FileInfo fileInfo = new FileInfo(fullPath); if (fileInfo.Exists) { _Response.Clear(); _Response.ClearHeaders(); _Response.Buffer = false; _Response.ContentType = "application/octet-stream"; _Response.ContentEncoding = Encoding.UTF8; _Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName); _Response.AppendHeader("Content-Length", fileInfo.Length.ToString()); _Response.TransmitFile(fullPath, 0L, fileInfo.Length); _Response.WriteFile(fileInfo.FullName); _Response.Flush(); _Response.End(); _Response.Close(); } }