Server.MapPath() eventually calls HostingEnvironment.MapPath(), but it creates a VirtualPath object with specific options:
The
VirtualPathobject passed toHostingEnvironment.MapPath()is constructed like this:VirtualPath.Create(path, VirtualPathOptions.AllowAllPath|VirtualPathOptions.AllowNull);
Edit: in reality, the only difference is that you are allowed to pass null to Server.MapPath(), but not to HostingEnvironment.MapPath()