public async Task <IActionResult> OnPostDownload(string filename) { var cert = azureHelper.GetCertificate(); var fileArray = cert.GetRawCertData(); return(await Task.Run(() => File(fileArray, "application/pkix-cert", cert.IssuerName.Name.Replace("CN=", "") + ".cer"))); }