Benny Sutton is 4 hire - just click here

Get the full physical path to a file

Get the full physical path to a file from the root virtual path (without using HttpContext.Current on your class)

           
        public static string PhysicalPathFromRootPath(this string rootpath)
        {
            HttpContext _ctx = HttpContext.Current;
            return _ctx.Server.MapPath(rootpath);
        }
        
    

Extension methods are easy to chain, simply call like this...

         
                         if (!File.Exists(rootpath.PhysicalPathFromRootPath())) throw new Exception("The file specified to load does not exist");