Scenario, I have a webpage, when a user open it they fill out a form and can download a T&C pdf file.
How to do this?
This is my controller code:
public FileResult DownloadFile()
{
byte[] fileBytes = System.IO.File.ReadAllBytes(@"\\server\wwwroot\testapp\Files\Terms and Conditions.pdf");
string fileName = "Terms and Conditions.pdf";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
What do I do on the Index (.cshtml) page for a download link?
CodePudding user response:
Does the "Terms and Conditions.pdf" file change in anyway based on the data captured when the user completes the form? If not, could you not simply use an
<a href="https://example.com/testapp/Terms and Conditions.pdf">Terms and Conditions</a>
link?