1234567891011121314151617181920212223242526272829303132 |
- // <author></author>
- // <date></date>
- // <description></description>
- using System.Text.RegularExpressions;
- namespace ERP.Framework.Utils
- {
- public class UrlUtil
- {
- public static bool Match(string route, List<string> 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;
- }
- }
- }
|