title: How to set CreationDate of downloaded file in C#
body: <p>I have files in an Azure Blob Storage. On a webpage these files can be downloaded.</p>
  
  <p>This works fine but the <code>creation date</code> and <code>modified date</code> are not set like I need them to.</p>
  
  <p>Here's some code:</p>
  
  <pre><code>    [HttpGet]
      public HttpResponseMessage Download()
      {
          Download download;
          [...]
          var fileStorage = new BlobStorage(download.ContainerName);
  
          BlobProperties blobProperties;
          var result = new HttpResponseMessage(HttpStatusCode.OK)
          {
              Content = new ByteArrayContent(fileStorage.Download(download.Url, out blobProperties))
          };
  
          result.Content.Headers.LastModified = blobProperties.LastModified;
  
          result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
          {
              FileName = download.FileName,
              CreationDate = blobProperties.LastModified,
              ModificationDate = blobProperties.LastModified,
              Size = blobProperties.Length
          };
  
          result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
          return result;
      }
  </code></pre>
  
  <p><code>blobProperties.LastModified</code> has the correct DateTimeOffset value. But when I look at the downloaded file on my disk (running Windows) the date of the file is different. Sometimes it is the current date when downloaded. Sometimes a complete other date which can be sooner or later than the <code>blobProperties.LastModified</code>.</p>
  
  <p>When you have a download folder with lots of files this makes it very difficult to find the file.</p>
  
  <p>I need either the current date or the date from the blog properties but not a seemingly random date.</p>
  
  <p>Here's the Fiddler output:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: private
  Content-Length: 802074
  Content-Type: application/octet-stream
  Last-Modified: Tue, 13 Nov 2018 10:17:20 GMT
  Server: Microsoft-IIS/10.0
  Content-Disposition: attachment; filename="myFile.xlsx"; creation-date="Tue, 13 Nov 2018 10:17:20 GMT"; modification-date="Tue, 13 Nov 2018 10:17:20 GMT"; size=802074
  X-AspNet-Version: 4.0.30319
  X-SourceFiles: =?UTF-8?B?R?=
  X-Powered-By: ASP.NET
  Date: Fri, 07 Dec 2018 09:53:17 GMT
  </code></pre>
  
  <p>As you can see the date is set to Nov. 13, the current date is Dec. 7 but the date on my disk is <code>26-9-2018 16:54</code></p>
  
  <p>Any pointers will be much appreciated.</p>