Permalink
Browse files

Added Content-Length header when writing files to output.

  • Loading branch information...
1 parent 15bccad commit 03e08ccc5497f33f209eb91bca2a1d15c2d29384 @KevM KevM committed with Jun 17, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/FubuMVC.Core/Runtime/HttpResponseOutputWriter.cs
View
12 src/FubuMVC.Core/Runtime/HttpResponseOutputWriter.cs
@@ -1,3 +1,4 @@
+using System.IO;
using System.Web;
namespace FubuMVC.Core.Runtime
@@ -9,10 +10,13 @@ public void WriteFile(string contentType, string localFilePath, string displayNa
HttpResponse response = HttpContext.Current.Response;
response.ContentType = contentType;
- if (displayName != null)
- {
- response.AppendHeader("content-disposition", "attachment; filename=" + displayName);
- }
+ if (displayName != null)
+ {
+ response.AppendHeader("Content-Disposition", "attachment; filename=" + displayName);
+ }
+
+ var fileInfo = new FileInfo(localFilePath);
+ response.AppendHeader("Content-Length", fileInfo.Length.ToString());
response.WriteFile(localFilePath);
}

0 comments on commit 03e08cc

Please sign in to comment.