public HttpResponseMessage ExportEntriesForNavision([FromBody] EntryFilter filter) { using (MemoryStream stream = new FileExport().GetExportFile(filter, User, new TimeEntryAccess())) { var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(stream.GetBuffer()) }; result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = "Test.csv" }; result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); return(result); } }