string fileName = Path.Combine(path, name); FileInfo fileInfo = new FileInfo(fileName); //FileInfo fileInfo = new FileInfo(fileName); //fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.Read); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8)); HttpContext.Current.Response.AddHeader("Content-Length", fileInfo.Length.ToString()); HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary"); HttpContext.Current.Response.ContentType = "application/octet-stream"; //Response.ContentEncoding = System.Text.Encoding.GetEncoding("shift-jis"); //Response.ContentType = "application/x-xls"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; HttpContext.Current.Response.WriteFile(fileInfo.FullName); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End();