using System; using System.Text.RegularExpressions; namespace Domain.Helpers { public class StringHelper { private static Regex reUrlOrigin = new Regex(@"(.+://[^/]+)"); public static string GetOriginFromUrl(string url) { var match = reUrlOrigin.Match(url); if (match.Success) { return match.Groups[1].Value; } return null; } } }
553800cookie-checkC# Get origin from url