Beispiel #1
0
        public static void HandleUseSSL()
        {
            var context = HttpContext.Current;

            if (!context.Request.IsSecureConnection && Convert.ToBoolean(ComplianceConfigurationManager.GetString("ComplianceUseSSL")))
            {
                var secureUrlBuilder = new UriBuilder(new Uri(context.Request.Url, context.Request.RawUrl))
                {
                    Scheme = Uri.UriSchemeHttps
                };

                var httpsPort = ComplianceConfigurationManager.GetString("HttpsPort");
                secureUrlBuilder.Port = string.IsNullOrEmpty(httpsPort) ? 443 : Convert.ToInt32(httpsPort);

                context.Response.Redirect(secureUrlBuilder.Uri.AbsoluteUri);
            }
        }
Beispiel #2
0
        private void ConfigureServerRegistrar()
        {
            string            serverModeString = ComplianceConfigurationManager.GetString("ProductServerMode");
            ProductServerMode serverMode;

            if (!Enum.TryParse <ProductServerMode>(serverModeString, out serverMode))
            {
                serverMode = ProductServerMode.None;
            }

            switch (serverMode)
            {
            case ProductServerMode.None:
                break;
                //case ProductServerMode.Master:
                //    ServerRegistrarResolver.Current.SetServerRegistrar(new MasterServerRegistrar());
                //    break;
                //case ProductServerMode.Slave:
                //    ServerRegistrarResolver.Current.SetServerRegistrar(new FrontEndReadOnlyServerRegistrar());
                //    break;
            }
        }