Argentini.Halide.H3Storage.MapPath C# (CSharp) Méthode

MapPath() public static méthode

Transforms relative path to exact path for web and console apps.
public static MapPath ( string path ) : string
path string Web-style path to a file (e.g. "/downloads/file.jpg").
Résultat string
        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;
        }