ASP.NET MVC – Find Absolute Path to the App_Data folder from Controller

ASP.NET MVC1 -> MVC3

string path = HttpContext.Current.Server.MapPath("~/App_Data/somedata.xml");

ASP.NET MVC4

string path = Server.MapPath("~/App_Data/somedata.xml");


MSDN Reference:

HttpServerUtility.MapPath Method

Leave a Comment