public static string MapPath(string path)
{
string filename = "";
if (path.Length > 1)
{
if (HttpContext.Current != null)
{
filename = HttpContext.Current.Server.MapPath(path);
}
else
{
if (path.StartsWith("/"))
{
path = path.Substring(1, path.Length - 1);
}
filename = AppDomain.CurrentDomain.BaseDirectory + path.Replace("/", "\\");
}
}
return filename;
}