ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,573 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi all!
I coded a Web Api wich generates and returns a pdf file, in Blazor Server web app.
It works, I can write the controller url and the pdf file shows correcty.
But I want to open it when the user clics a button. I think it wouldn't be hard, but I can't manage it.
My Controller:
[HttpGet]
[Route("InformeClientes")]
public IActionResult ClientesReport()
{
DataTable dt = [function to generate report data]
var path = [path to the report definicion - rdlc]
[open report]
[fill report with data]
var result = localReport.Execute(RenderType.Pdf, 1, parameters, "");
return File(result.MainStream, System.Net.Mime.MediaTypeNames.Application.Octet, "Informe.pdf");
}
If I call it this way:
void Exportar()
{
var fichero = clienteHttp.GetAsync("api/Clientes/InformeClientes");
}
The variable get filled, and no erros occurs, so I think it works (and if I write the api url in the browser the pdf is shown) How can I show the file in new tab programmatically?
Thanks.