Consider a UserGuide PDF file that must provide help for website users.
Here is the link to it in view :
@Html.ActionLink("User Guide","Help","Portal")
the controller that returns the file :
public ActionResult Help()
{
string path = Server.MapPath("~/Content/UserGuide.pdf");
var fileBytes = System.IO.File.ReadAllBytes(path);
var responseFile = new FileContentResult(fileBytes, "application/pdf")
{
FileDownloadName = "Guide.pdf"
};
return responseFile;
}
but here, after user clicks the link, browser will prompt for downloading the file but the better way is, when user clicks the link, PDF pages show up inside browser. Just like a web page! can any body mention the best way to achieve this?