コード例 #1
0
        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);
        }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 /// <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);
 }