ASP.NET Core: Replacement for Server.MapPath

ASP.NET Core offers two different locations for files:

Content root – this is where application binaries and other private files are held.
Web root – this is where public files are held (wwwroot folder in web project).

By default, web root is located under content root. But there are also deployments where web root is located somewhere else. I have previously seen such deployments on Azure Web Apps. It’s possible that some ISPs also use different directories in trees for application files and web root.