Exemple #1
0
        public HostingSettingsProvider(IHostingSettings hostingSettings)
        {
            if (hostingSettings == null)
            {
                throw new ArgumentNullException(nameof(hostingSettings));
            }

            var scheme = hostingSettings.IsSecure ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;
            var port   = hostingSettings.IsSecure ? hostingSettings.SecurePort : hostingSettings.Port;
            var root   = $@"/{hostingSettings.Suffix.TrimSafely()}".AppendSlash();

            string CreateUrl(string hostSpecifier) => $@"{scheme}://{hostSpecifier}:{port}{root}";

            RootUrl             = CreateUrl(LocalHelper.GetHostName());
            RootRegistrationUrl = CreateUrl("+");
        }