Server.Mappath in C# classlibrary

Shyju picture Shyju · Jul 29, 2009 · Viewed 119.6k times · Source

How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite

Answer

Aaron Powell picture Aaron Powell · Jul 29, 2009

By calling it?

var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");

Make sure you add a reference to the System.Web assembly.