Esempio n. 1
0
        public static void Download(HttpResponse response, string filePath, string fileName)
        {
            var fileType       = PathUtils.GetExtension(filePath);
            var fileSystemType = EFileSystemTypeUtils.GetEnumType(fileType);

            response.Buffer = true;
            response.Clear();
            response.ContentType = EFileSystemTypeUtils.GetResponseContentType(fileSystemType);
            response.AddHeader("Content-Disposition", "attachment; filename=" + UrlEncode(fileName));
            response.WriteFile(filePath);
            response.Flush();
            response.End();
        }