// // // using System.Text.RegularExpressions; namespace ERP.Framework.Utils { public class UrlUtil { public static bool Match(string route, List whiteList) { if (!route.EndsWith("/")) { route += "/"; } foreach (var pattern in whiteList) { var regexPattern = "^" + Regex.Escape(pattern).Replace("\\*", ".*") + "$"; var regex = new Regex(regexPattern); if (regex.IsMatch(route)) { return true; } } return false; } } }