How to use Server.MapPath in ASP.NET MVC 4?
You can use Server.MapPath in ASP.NET MVC 4 like this:String path = HttpContext.Current.Server.MapPath(“~/myFolder/myFile.txt”);You can use the way mentioned above but ASP.NET MVC 4 has another way to map files on server and that is using HostingEnvironment class. Actually Server.MapPath() also internally calls HostingEnvironment.MapPath() to map the file paths on server. It belongs to the System.Web.Hosting … Read more