I have an XML file being generated filled with information from the Razor page, and I want to download this generated XML file on the click of a download button. I'm new to Razor pages, and returning the XML file as a FileResult isn't working for me. Guidance on what to write for my <a> and how to set up the C# annotations, etc would be very helpful.
My .cshtml code is:
<br/> 
@Html.ActionLink("Link name", "SaveFile", "EditLicense", 
        new { 
           LicenseFileJson = JsonConvert.SerializeObject(Model.License) 
        }) 
<br/> 
When this gets displayed on the page I get:
<br/> <a href="">Link name</a><br/> 
and clicking it does nothing.
My action code is:
public class EditLicenseController : Controller
{
    public FileResult SaveFile(string LicenseFileJson)
    {
        License License = (License)JsonConvert.DeserializeObject(LicenseFileJson);
        LicenseTool tool = new LicenseTool(License);
        string licenseFileString = tool.ToFileString();
        byte[] bytes = Encoding.ASCII.GetBytes(licenseFileString);
        var stream = new MemoryStream();
        var writer = new StreamWriter(stream);
        writer.Write(licenseFileString);
        writer.Flush();            
        Response.Headers.Add("Content-Disposition", "attachment;");
        return File(bytes, "text/xml", "testing123.xml");
    }
    ...
When I click the link I also don't see anything indicating this is working in the Network tab of chrome dev tools.
 
     
    
