I have developed a simple ASP.NET Core MVC web app which has this controller class and this view to show a PDF file:
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
}
View:
<html>
<head>
<title class="text-center"></title>
</head>
<body>
<div class="text-center">
<a href="~/file/MYCV.pdf">Click to view my CV</a></div>
</body>
</html>
Now using Filezilla, I upload the files to our Bluehost provider, where the files got added on the root as follows:
but when I access the site, I get this error:
Forbidden
You don't have permission to access this resource.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Basically 403 forbidden error message happened when you haven't setup your own default page correctly. You may refer to this post https://dotnetblog.asphostportal.com/how-to-fix-403-forbidden-error-message/