public async Task <IActionResult> DownloadJobSeekerData(string password) { string personalDataFileName = "JobFinder_Data_{0}-{1}.json"; var user = await userManager.GetUserAsync(User); var isPasswordValid = !await userManager.HasPasswordAsync(user) || password != null && await userManager.CheckPasswordAsync(user, password); if (!isPasswordValid) { this.Error(NotificationMessages.InvalidPassword); return(this.RedirectToAction("Dashboard", "JobSeeker")); } var jobSeeker = await this.jobSeekerService.GetJobSeeker(User.Identity.Name); var personalData = await personalDataService.GetPersonalDataForJobSeekerJson(jobSeeker.Id); Response.Headers.Add("Content-Disposition", "attachment; filename=" + string.Format(personalDataFileName, jobSeeker.FirstName, jobSeeker.LastName)); return(new FileContentResult(Encoding.UTF8.GetBytes(personalData), "text/json")); }