public static void WriteDown(string filePath, string filename) { HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = GetResponseContentType(Path.GetExtension(filePath)); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + FPUtils.UrlEncode(filename)); HttpContext.Current.Response.WriteFile(filePath); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); }