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(); }
public static List <string> GetOriginalStyleImageUrls(string html) { var list = GetContents("url", "url\\((?<url>[^\\(\\)]*)\\)", html); var urlList = new List <string>(); foreach (var url in list) { if (!urlList.Contains(url) && EFileSystemTypeUtils.IsImage(PathUtils.GetExtension(url))) { urlList.Add(url); } } return(urlList); }