Using Server.MapPath in external C# Classes in ASP.NET
The ServerUtility class is available as an instance in your HttpContext. If you’re in an environment where you know it’ll be executed inside the ASP.Net pipeline, you can use HttpContext.Current.Server.MapPath() You’ll have to import System.Web though.