Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpGet]
- [OutputCache(Duration = 60, VaryByParam = "none", Location =
- OutputCacheLocation.Client, NoStore = true)]
- public FileResult AppleUserDataReport()
- {
- using (ZipFile zip = new ZipFile())
- {
- zip.Password = Membership.GeneratePassword(12, 1);
- var sb = _service.GetAppleUsersByClientId(User.ClientId);
- var reportName = "AppleUserData_Downloaded_" + DateTime.UtcNow.ToString("yyyy_MM_dd");
- var contentType = "text/xml";
- var bytes = Encoding.UTF32.GetBytes(sb.ToString());
- var result = new FileContentResult(bytes, contentType);
- result.FileDownloadName = reportName + ".csv";
- zip.AddFile(result.FileDownloadName, "file");
- zip.Save("C:\MyZipFile.zip");
- return result;
- }
- }
Add Comment
Please, Sign In to add comment