Ejemplo n.º 1
0
        /// <summary>
        /// Removes Application Path from Url if present and ensures starts with /
        /// </summary>
        /// <param name="Url">The Url (Relative)</param>
        /// <param name="ApplicationPath"></param>
        /// <param name="SiteName">SiteName, if provided will also remove the site's forbidden and replacement characters</param>
        /// <returns></returns>
        public static string GetUrl(string RelativeUrl, string ApplicationPath, string SiteName = "")
        {
            // Remove Application Path from Relative Url if it exists at the beginning
            if (!string.IsNullOrWhiteSpace(ApplicationPath) && ApplicationPath != "/" && RelativeUrl.ToLower().IndexOf(ApplicationPath.ToLower()) == 0)
            {
                RelativeUrl = RelativeUrl.Substring(ApplicationPath.Length);
            }

            return(DynamicRouteInternalHelper.GetCleanUrl(RelativeUrl, SiteName));
        }