public static string MapPath(string path) { string result; if (string.IsNullOrEmpty(path)) { result = string.Empty; } else { HttpContext current = HttpContext.Current; if (current != null) { result = current.Request.MapPath(path); } else { result = Globals.PhysicalPath(path.Replace("/", Path.DirectorySeparatorChar.ToString()).Replace("~", "")); } } return(result); }