I have created the pdf file in the MVC Controller in ASP.NET Core 3. I am returning the FileStreamResult
from this controller.
I want to open the PDF in a new browser window.
Below is the HTML Code -
<a asp-controller="Score" asp-action="ViewScore" target="_blank" >View PDF</a>
Below is the controller
public async Task<IActionResult> ViewScore()
{
/*Created the pdf doc*/
MemoryStream stream = new MemoryStream();
stream = doc1.Stream;
string contentType = "application/pdf";
string fileName = "sample.pdf";
var file = File(stream, contentType, fileName);
return file;
}
I am getting the downloading option for the pdf file. Instead of that, I want to open the pdf in the new browser window.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…