Returning File

I am attempting to return a file from a web api in my Radzen app. I receive no errors, nothing hangs, but nothing is returned either. Anything to help would be most appreicated. Code below.

[Inject]
HttpClient httpclient { get; set; }

    public async Task<FileStreamResult> exportReport (string start, string end)
    {
        var request = new HttpRequestMessage
        {
            RequestUri = new Uri("http://127.0.0.1/api/values/?start="+start+"&end="+end),
            Method = HttpMethod.Get
        };
        
        var response = await httpclient.SendAsync(request);
        var stream = await response.Content.ReadAsStreamAsync();
        
        var result = new FileStreamResult(stream,"application/pdf");
        result.FileDownloadName = "File.pdf";

        return result;

    }

Returning files in Blazor can be tricky. Check how Radzen does export to CSV and Excel.

I am using the same method I though compared to export. I am using a filestreamresult, I think i mimicked the majority of the content of the export method in the export controller. In debug I am able to verify content of all objects. Its weird, it just doesn't do anything. Only difference is I am calling it asynchronously

Any other suggestions?

That’s the problem. The export is using full navigation to get the file.

Any suggestions on how to do a httprequest without async.

@jheatherington check the export controllers - it will be easier to get the file using NavigationManager.

I am experiencing a similar issue. My download works; however, after the download, the page requires a reload. I am using NavigationManager, Controllers, everything outlined in the documentation and examples. Is this a Radzen bug??