예제 #1
0
        public static string GetBaseDomain(HttpContextBase context, bool includeScheme)
        {
            var    approved = GetSerializer();
            string domain   = context.Request.Url?.DnsSafeHost;
            bool   isHttps  = context.Request.IsSecureConnection;

            var locator = new BaseDomainLocator(approved);

            return(locator.Get(domain, isHttps, includeScheme));
        }
예제 #2
0
        public void ShouldLocateDomainWithoutSchemeTest()
        {
            var    domains = new FakeDomainSerializer();
            var    locator = new BaseDomainLocator(domains);
            string domain  = "www.example.com";

            string expected = "example.com";
            string result   = locator.Get(domain, false, false);

            Assert.Equal(expected, result);
        }