Server.MapPath is throwing error in MVC? use HostingEnvironment.MapPath instead.
HostingEnvironment.MapPath needs to include to use System.Web.Hosting.
Following is the sample code:
HostingEnvironment.MapPath needs to include to use System.Web.Hosting.
Following is the sample code:
var file = System.IO.File.AppendText(System.Web.Hosting.HostingEnvironment.MapPath("~/logs/error.txt"));