public async Task <ActionResult> ExportToPDFFile(AdvancedSearchViewModel advancedSearchViewModel) { if (advancedSearchViewModel.AccountID == 0) { advancedSearchViewModel.AccountID = this.Identity.ToAccountID(); } advancedSearchViewModel.PageNumber = 1; ExportSearchResponse exportResponse = await advancedSearchService.ExportSearchToPDFAsync(new ExportSearchRequest() { SearchViewModel = advancedSearchViewModel, FileType = "PDF", DateFormat = this.Identity.ToDateFormat(), TimeZone = this.Identity.ToTimeZone() }); string fileKey = Guid.NewGuid().ToString(); bool result = cachingService.StoreTemporaryFile(fileKey, exportResponse.byteArray); Logger.Current.Informational("Did temporary file stored in cache : " + result.ToString()); return(Json(new { success = true, fileKey = fileKey, fileName = exportResponse.FileName }, JsonRequestBehavior.AllowGet)); }