private static void SetupHttpContentDispositionForDownload(HttpResponseBase response, DownloadFileDescriptor descriptor, Encoding downloadContentEncoding) { response.ContentType = descriptor.MimeType; response.ContentEncoding = downloadContentEncoding; var filename = descriptor.ToStandardizedCsvDownloadFilename(); var contentDisposition = String.Format("attachment; filename=\"{0}\"", filename); response.AddHeader("Content-Disposition", contentDisposition); }
/// <summary> /// Adds the proper HTTP headers for a file download. <see> /// <cref>SitkaGlobalBase.AddCachingHeaders</cref> /// </see> /// </summary> public static void SetupHttpHeadersForDownload(HttpResponseBase response, DownloadFileDescriptor descriptor, Encoding downloadContentEncoding) { SetupHttpHeadersForDownloadImpl(response, descriptor, downloadContentEncoding); }
private static void SetupHttpHeadersForDownloadImpl(HttpResponseBase response, DownloadFileDescriptor descriptor, Encoding downloadContentEncoding) { // Leaving this ClearHeaders since it is IMMEDIDATELY followed by a line replacing the SetExpires below. -- SLG 10/2/2012 response.ClearHeaders(); SetupHttpContentDispositionForDownload(response, descriptor, downloadContentEncoding); SetupHttpCachingHeaders(response); }
/// <summary> /// Adds the proper HTTP headers for a file download. <see> /// <cref>SitkaGlobalBase.AddCachingHeaders</cref> /// </see> /// </summary> public static void SetupHttpHeadersForDownload(HttpResponseBase response, DownloadFileDescriptor descriptor) { SetupHttpHeadersForDownloadImpl(response, descriptor, Encoding.Default); }