Esempio n. 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            bool BadSSL = false;

            // save the config settings:
            AtomStoreZip.Save();
            AtomLiveServer.Save();

            StringBuilder errors = new StringBuilder();

            if (AppLogic.TrustLevel == AspNetHostingPermissionLevel.Unrestricted)
            {
                WebConfigManager webMgr = new WebConfigManager();
                if (webMgr.ProtectWebConfig != rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase) || rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                {
                    webMgr.ProtectWebConfig = rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);

                    if (rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        webMgr.SetMachineKey          = true;
                        webMgr.ValidationKeyGenMethod = WebConfigManager.KeyGenerationMethod.Auto;
                        webMgr.DecryptKeyGenMethod    = WebConfigManager.KeyGenerationMethod.Auto;
                    }

                    List <Exception> saveWebConfigExceptions = webMgr.Commit();

                    WebConfigManager webMgrNew = new WebConfigManager();

                    if (saveWebConfigExceptions.Count > 0 && (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig || rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true")))
                    {
                        if (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig)
                        {
                            errors.Append("Your web config encryption could not be changed due to the following error(s): <br />");
                        }
                        if (rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true"))
                        {
                            errors.Append("Could not set static machine key due to the following error(s): <br />");
                        }
                        foreach (Exception ex in saveWebConfigExceptions)
                        {
                            errors.Append(ex.Message + "<br />");
                        }
                    }
                }
            }

            if (AtomStoreUseSSL.GetValue(AppLogic.StoreID()).ToBool() || AtomStoreUseSSL.GetValue(0).ToBool())
            {
                BadSSL = true;
                String        WorkerWindowInSSL = String.Empty;
                List <string> urlsToTry         = new List <string>();
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm");
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://").Replace("https://", "https://www.") + "empty.htm");

                foreach (String urlToTry in urlsToTry)
                {
                    if (BadSSL)
                    {
                        try
                        {
                            WorkerWindowInSSL = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm", 10);
                        }
                        catch { }

                        if (WorkerWindowInSSL.IndexOf("Worker") != -1)
                        {
                            AtomStoreUseSSL.Save();
                            BadSSL = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                AtomStoreUseSSL.Save();
            }

            AtomLiveServer.Save();
            AtomStoreCurrency.Save();
            AtomStoreCurrencyNumeric.Save();
            AtomStoreName.Save();
            AtomStoreLiveTransactions.Save();

            string temp = GetCheckedPaymentMethods();

            AppConfig config = AppLogic.GetAppConfig(0, "UseSSL");

            config = AppLogic.GetAppConfig(0, "PaymentMethods");
            if (config != null)
            {
                if (temp.Length > 0)
                {
                    config.ConfigValue = temp;
                }
                else
                {
                    config.ConfigValue = string.Empty;
                }
            }

            config = AppLogic.GetAppConfig(0, "Micropay.Enabled");
            if (config != null)
            {
                if (temp.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    config.ConfigValue = "true"; // preserve setting of obsolete appconfig
                }
                else
                {
                    config.ConfigValue = "false"; // preserve setting of obsolete appconfig
                }
            }

            config = AppLogic.GetAppConfig(0, "PaymentGateway");
            if (config != null)
            {
                string newGateway        = getSelectedGateway();
                string newGatewayProduct = getSelectedGatewayProduct();

                if (!String.IsNullOrEmpty(newGateway))
                {
                    config.ConfigValue = newGateway;
                }

                if (newGateway == "PayFlowPro")
                {
                    var payFlowProProduct = AppLogic.GetAppConfig(0, "PayFlowPro.Product");
                    payFlowProProduct.ConfigValue = newGatewayProduct;

                    // If PPA Gateway is selected, then set the PPA Method
                    if (newGatewayProduct == "PayPal Payments Advanced")
                    {
                        if (!temp.Contains("PayPalEmbeddedCheckout"))
                        {
                            var ppaConfig = AppLogic.GetAppConfig(0, "PaymentMethods");
                            ppaConfig.ConfigValue += ", PayPalEmbeddedCheckout";
                        }
                    }

                    // if any PayFlow gateway is selected, select PayPalExpress
                    if (!temp.Contains("PayPalExpress"))
                    {
                        var ppeConfig = AppLogic.GetAppConfig(0, "PaymentMethods");
                        ppeConfig.ConfigValue   += ", PayPalExpress";
                        cbxPayPalExpress.Checked = true;
                    }
                }
            }

            if ("WIZARD".Equals(AppLogic.AppConfig("OrderShowCCPwd", 0, false), StringComparison.InvariantCultureIgnoreCase))
            {
                config = AppLogic.GetAppConfig(0, "OrderShowCCPwd");
                if (config != null)
                {
                    config.ConfigValue = CommonLogic.GetRandomNumber(1000, 1000000).ToString() + CommonLogic.GetRandomNumber(1000, 1000000).ToString() + CommonLogic.GetRandomNumber(1000, 1000000).ToString();
                }
            }

            string BuySafeMessage = string.Empty;

            if (rblBuySafeEnabled.SelectedIndex == 1)
            {
                BuySafeRegistrationStatus bss = BuySafeController.BuySafeOneClickSignup();
                if (!bss.Sucessful)
                {
                    BuySafeMessage = "<br/><b style=\"color:red;\">buySAFE could not be enabled.{0}";
                    errors.Append(string.Format(BuySafeMessage, (string.IsNullOrEmpty(bss.ErrorMessage) ? "" : " Error message: " + bss.ErrorMessage)));
                }
            }

            if (BadSSL)
            {
                errors.Append("No SSL certificate was found on your site. Please check with your hosting company! You must be able to invoke your store site using https:// before turning SSL on in this admin site!<br />");
            }

            if (errors.ToString().Length > 0)
            {
                resetError(errors.ToString(), true);
            }
            else
            {
                resetError("Configuration Wizard completed successfully.", false);
            }

            loadData();
        }
Esempio n. 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            bool changeEncryptKeySelected = rblChangeEncryptKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);
            bool changeMachineKeySelected = rblChangeMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);
            bool encryptKeyAutoGenerate   = rblEncryptKeyGenType.SelectedValue.Equals("auto", StringComparison.InvariantCultureIgnoreCase);
            bool machineKeyAutoGenerate   = rblMachineKeyGenType.SelectedValue.Equals("auto", StringComparison.InvariantCultureIgnoreCase);

            if (changeEncryptKeySelected && !encryptKeyAutoGenerate && (NewEncryptKey.Text.Trim().Length < 8 || NewEncryptKey.Text.Trim().Length > 50))
            {
                ErrorLabel.Text    = AppLogic.GetString("admin.changeencryptkey.AtLeast", SkinID, LocaleSetting);
                ErrorLabel.Visible = true;
                return;
            }

            if (changeMachineKeySelected)
            {
                if (!machineKeyAutoGenerate && (txtValidationKey.Text.Trim().Length < 32 || txtValidationKey.Text.Trim().Length > 64))
                {
                    ErrorLabel.Text    = AppLogic.GetString("admin.changeencryptkey.ValidationKeyAtLeast", SkinID, LocaleSetting);
                    ErrorLabel.Visible = true;
                    return;
                }
                else if (!machineKeyAutoGenerate && txtDecryptKey.Text.Trim().Length != 24)
                {
                    ErrorLabel.Text    = AppLogic.GetString("admin.changeencryptkey.DecryptKeyAtLeast", SkinID, LocaleSetting);
                    ErrorLabel.Visible = true;
                    return;
                }
            }

            try
            {
                WebConfigManager webMgr = new WebConfigManager();

                if (changeEncryptKeySelected)
                {
                    webMgr.SetEncryptKey       = true;
                    webMgr.EncryptKeyGenMethod = (WebConfigManager.KeyGenerationMethod)Enum.Parse(typeof(WebConfigManager.KeyGenerationMethod),
                                                                                                  rblEncryptKeyGenType.SelectedValue, true);

                    if (webMgr.EncryptKeyGenMethod == WebConfigManager.KeyGenerationMethod.Manual)
                    {
                        webMgr.EncryptKey = NewEncryptKey.Text;
                    }
                }

                if (changeMachineKeySelected)
                {
                    webMgr.SetMachineKey          = true;
                    webMgr.ValidationKeyGenMethod = (WebConfigManager.KeyGenerationMethod)Enum.Parse(typeof(WebConfigManager.KeyGenerationMethod),
                                                                                                     rblMachineKeyGenType.SelectedValue, true);

                    webMgr.DecryptKeyGenMethod = webMgr.ValidationKeyGenMethod;

                    if (webMgr.ValidationKeyGenMethod == WebConfigManager.KeyGenerationMethod.Manual)
                    {
                        webMgr.ValidationKey = txtValidationKey.Text;
                        webMgr.DecryptKey    = txtDecryptKey.Text;
                    }
                }

                List <Exception> commitExceptions = webMgr.Commit();

                if (commitExceptions.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("Your web.config could not be saved for the following reasons:<br/>");
                    foreach (Exception ex in commitExceptions)
                    {
                        sb.Append(ex.Message + "<br />");
                    }

                    ErrorLabel.Text    = sb.ToString();
                    OkLabel.Visible    = false;
                    ErrorLabel.Visible = true;
                }
                else
                {
                    ErrorLabel.Visible = false;
                    OkLabel.Visible    = true;
                }
            }
            catch (Exception ex)
            {
                ErrorLabel.Text    = CommonLogic.GetExceptionDetail(ex, "<br/>");
                OkLabel.Visible    = false;
                ErrorLabel.Visible = true;
            }
        }
Esempio n. 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            var BadSSL = false;

            // save the config settings:
            AtomStoreZip.Save();
            AtomLiveServer.Save();

            if (AtomStoreUseSSL.GetValue(AppLogic.StoreID()).ToBool() || AtomStoreUseSSL.GetValue(0).ToBool())
            {
                BadSSL = true;
                var WorkerWindowInSSL = string.Empty;
                var urlsToTry         = new List <string>();
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm");
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://").Replace("https://", "https://www.") + "empty.htm");

                foreach (var urlToTry in urlsToTry)
                {
                    if (BadSSL)
                    {
                        WorkerWindowInSSL = CommonLogic.AspHTTP(urlToTry, 10);

                        if (!string.IsNullOrEmpty(WorkerWindowInSSL) && WorkerWindowInSSL.IndexOf("Worker") != -1)
                        {
                            AtomStoreUseSSL.Save();
                            BadSSL = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                AtomStoreUseSSL.Save();
            }

            AtomLiveServer.Save();
            AtomStoreCurrency.Save();
            AtomStoreCurrencyNumeric.Save();
            AtomStoreName.Save();
            AtomStoreLiveTransactions.Save();

            var checkedPaymentMethods = GetCheckedPaymentMethods();

            AppConfigManager.SetAppConfigValue("PaymentMethods", checkedPaymentMethods);

            if (AppConfigManager.AppConfigExists("PaymentGateway"))
            {
                var newGateway = getSelectedGateway();

                if (!string.IsNullOrEmpty(newGateway))
                {
                    AppConfigManager.SetAppConfigValue("PaymentGateway", newGateway);
                }

                if (newGateway == "PayFlowPro")
                {
                    var newGatewayProduct = getSelectedGatewayProduct();
                    AppConfigManager.SetAppConfigValue("PayFlowPro.Product", newGatewayProduct);

                    // If PPA Gateway is selected, then set the PPA Method
                    if (newGatewayProduct == "PayPal Payments Advanced")
                    {
                        if (!checkedPaymentMethods.Contains("PayPalPaymentsAdvanced"))
                        {
                            var currentPaymentMethods = AppConfigManager.GetAppConfigValue("PaymentMethods");
                            AppConfigManager.SetAppConfigValue("PaymentMethods", string.Format("{0}, PayPalPaymentsAdvanced", currentPaymentMethods));
                        }
                    }

                    // if any PayFlow gateway is selected, select PayPalExpress
                    if (!checkedPaymentMethods.Contains("PayPalExpress"))
                    {
                        var currentPaymentMethods = AppConfigManager.GetAppConfigValue("PaymentMethods");
                        AppConfigManager.SetAppConfigValue("PaymentMethods", string.Format("{0}, PayPalExpress", currentPaymentMethods));
                        cbxPayPalExpress.Checked = true;
                    }
                }
            }

            string BuySafeMessage = string.Empty;

            if (rblBuySafeEnabled.SelectedIndex == 1)
            {
                var bss = BuySafeController.BuySafeOneClickSignup();
                if (!bss.Sucessful)
                {
                    BuySafeMessage = "buySAFE could not be enabled.{0}";
                    var buysafeResponse = string.IsNullOrEmpty(bss.ErrorMessage) ? "" : " Error message: " + bss.ErrorMessage;
                    ctrlAlertMessage.PushAlertMessage(string.Format(BuySafeMessage, buysafeResponse), AlertMessage.AlertType.Error);
                }
            }

            var errors = new StringBuilder();
            var webMgr = new WebConfigManager();

            if (AppLogic.TrustLevel == AspNetHostingPermissionLevel.Unrestricted)
            {
                if (webMgr.ProtectWebConfig != rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase) || rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                {
                    webMgr.ProtectWebConfig = rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);

                    if (rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        webMgr.SetMachineKey          = true;
                        webMgr.ValidationKeyGenMethod = WebConfigManager.KeyGenerationMethod.Auto;
                        webMgr.DecryptKeyGenMethod    = WebConfigManager.KeyGenerationMethod.Auto;
                    }

                    var saveWebConfigExceptions = webMgr.Commit();

                    var webMgrNew = new WebConfigManager();

                    if (saveWebConfigExceptions.Count > 0 && (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig || rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true")))
                    {
                        if (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig)
                        {
                            errors.Append("Your web config encryption could not be changed due to the following error(s): <br />");
                        }

                        if (rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true"))
                        {
                            errors.Append("Could not set static machine key due to the following error(s): <br />");
                        }

                        foreach (var ex in saveWebConfigExceptions)
                        {
                            errors.Append(ex.Message + "<br />");
                        }
                    }
                }
            }

            if (BadSSL)
            {
                errors.AppendFormat("{0}<br />", AppLogic.GetString("admin.wizard.BadSSL", ThisCustomer.LocaleSetting));
            }

            if (!webMgr.WebConfigRequiresReload)
            {
                Response.Redirect("wizard.aspx");
            }

            var errorMessage = errors.ToString();

            if (string.IsNullOrEmpty(errorMessage))
            {
                ctrlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.wizard.success", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);
            }
            else
            {
                ctrlAlertMessage.PushAlertMessage(errorMessage, AlertMessage.AlertType.Error);
            }

            loadData();
        }
        protected void btnUpdateEncryptKey_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtSecondaryEncryptKey.Text) &&
                (string.IsNullOrEmpty(txtSecondaryEncryptKeyConfirm.Text)))
            {
                ctlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.changeencrypt.SecondaryEncryptKey.Confirm.Required"), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                return;
            }

            var changeEncryptKeySelected = rblChangeEncryptKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);
            var changeMachineKeySelected = rblChangeMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);
            var machineKeyAutoGenerate   = rblMachineKeyGenType.SelectedValue.Equals("auto", StringComparison.InvariantCultureIgnoreCase);

            var primaryEncryptKey = txtPrimaryEncryptKey
                                    .Text
                                    .Trim();

            var secondaryEncryptKey = txtSecondaryEncryptKey
                                      .Text
                                      .Trim();

            var combinedEncryptKey = string.Concat(primaryEncryptKey, secondaryEncryptKey);

            var validationKey = txtValidationKey.Text.Trim();
            var decryptKey    = txtDecryptKey.Text.Trim();

            if (changeEncryptKeySelected &&
                (string.IsNullOrWhiteSpace(primaryEncryptKey) ||
                 combinedEncryptKey.Length < 8 ||
                 combinedEncryptKey.Length > 50))
            {
                ctlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.changeencryptkey.AtLeast", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                return;
            }

            if (changeMachineKeySelected)
            {
                if (!machineKeyAutoGenerate && (validationKey.Length < 32 || validationKey.Length > 64))
                {
                    ctlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.changeencryptkey.ValidationKeyAtLeast", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                    return;
                }
                else if (!machineKeyAutoGenerate && decryptKey.Length != 24)
                {
                    ctlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.changeencryptkey.DecryptKeyAtLeast", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                    return;
                }
            }

            try
            {
                var webConfigManager = new WebConfigManager();

                if (changeEncryptKeySelected)
                {
                    webConfigManager.SetEncryptKey       = true;
                    webConfigManager.EncryptKeyGenMethod = WebConfigManager.KeyGenerationMethod.Manual;

                    var encryptIterations    = AppLogic.AppConfigNativeInt("EncryptIterations");
                    var hashAlgorithm        = AppLogic.AppConfig("HashAlgorithm");
                    var initializationVector = AppLogic.AppConfig("InitializationVector");
                    var keySize = AppLogic.AppConfigNativeInt("KeySize");

                    var keyEncryptionKeyConfig = GlobalConfig.GetGlobalConfig(Security.KeyEncryptionKeyName);
                    var tertiaryEncryptionKey  = ConfigurationManager.AppSettings[Security.TertiaryEncryptionKeyName];

                    var keyEncryptionKeyConfigExists = keyEncryptionKeyConfig != null && !string.IsNullOrWhiteSpace(keyEncryptionKeyConfig.ConfigValue);
                    var tertiaryEncryptionKeyExists  = !string.IsNullOrWhiteSpace(tertiaryEncryptionKey);

                    if ((keyEncryptionKeyConfigExists && !tertiaryEncryptionKeyExists) ||
                        (!keyEncryptionKeyConfigExists && tertiaryEncryptionKeyExists))
                    {
                        throw new ArgumentException("Both the key encryption key and tertiary encryption key were expected to be found but one or the other is missing. At this point you cannot recover encrypted data until you restore the original values. You can recover from this error by clearing both encryption keys but you will not be able to recover encrypted data.");
                    }

                    if (string.IsNullOrWhiteSpace(keyEncryptionKeyConfig.ConfigValue))
                    {
                        // No KEK has been created, make one along with a TEK.
                        tertiaryEncryptionKey = Security.CreateRandomKey(64);
                        webConfigManager.TertiaryEncryptionKey = tertiaryEncryptionKey;

                        var keyEncryptionKey = Security.CreateRandomKey(64);
                        webConfigManager.KeyEncryptionKey = keyEncryptionKey;

                        // Encrypt the KEK using the TEK and store it in the database.
                        var encryptedKEK = Security.MungeString(
                            value: keyEncryptionKey,
                            saltKey: string.Empty,
                            securityParams: new Security.SecurityParams
                        {
                            EncryptKey           = tertiaryEncryptionKey,
                            EncryptIterations    = encryptIterations,
                            HashAlgorithm        = hashAlgorithm,
                            InitializationVector = initializationVector,
                            KeySize = keySize
                        });
                        keyEncryptionKeyConfig.ConfigValue = encryptedKEK;
                        keyEncryptionKeyConfig.Save();
                    }
                    else
                    {
                        // A KEK has already been generated, pull the TEK, decrypt the KEK with the TEK and prep
                        //  the WebConfigManager with the decrypted keys to encrypt the EncryptKey.
                        webConfigManager.TertiaryEncryptionKey = ConfigurationManager.AppSettings[Security.TertiaryEncryptionKeyName];
                        webConfigManager.KeyEncryptionKey      = Security.UnmungeString(
                            s: keyEncryptionKeyConfig.ConfigValue,
                            SaltKey: string.Empty,
                            p: new Security.SecurityParams
                        {
                            EncryptKey           = webConfigManager.TertiaryEncryptionKey,
                            EncryptIterations    = encryptIterations,
                            HashAlgorithm        = hashAlgorithm,
                            InitializationVector = initializationVector,
                            KeySize = keySize
                        });;
                    }

                    // If the merchant has specified their encrypt key, set the WebConfigManager's EncryptKey
                    //  property to the plain text value to re-encrypt already encrypted data. The EncryptKey
                    //  will be later encrypted in the AppSettings file. If we're auto-generating an EncryptKey
                    //  then just pass an empty string.
                    if (webConfigManager.EncryptKeyGenMethod == WebConfigManager.KeyGenerationMethod.Manual)
                    {
                        webConfigManager.EncryptKey = combinedEncryptKey;
                    }
                    else
                    {
                        webConfigManager.EncryptKey = string.Empty;
                    }
                }

                if (changeMachineKeySelected)
                {
                    webConfigManager.SetMachineKey          = true;
                    webConfigManager.ValidationKeyGenMethod = (WebConfigManager.KeyGenerationMethod)Enum.Parse(
                        enumType: typeof(WebConfigManager.KeyGenerationMethod),
                        value: rblMachineKeyGenType.SelectedValue,
                        ignoreCase: true);

                    webConfigManager.DecryptKeyGenMethod = webConfigManager.ValidationKeyGenMethod;

                    if (webConfigManager.ValidationKeyGenMethod == WebConfigManager.KeyGenerationMethod.Manual)
                    {
                        webConfigManager.ValidationKey = validationKey;
                        webConfigManager.DecryptKey    = decryptKey;
                    }
                }

                var commitExceptions = webConfigManager.Commit();
                if (commitExceptions.Any())
                {
                    var errorMessage = commitExceptions
                                       .Aggregate(
                        new StringBuilder("Your web.config could not be saved for the following reasons:<br />"),
                        (message, exception) => message.AppendFormat("{0}<br />", exception.Message))
                                       .ToString();

                    ctlAlertMessage.PushAlertMessage(errorMessage, AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                }
                else
                {
                    ctlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.changeencryptkey.Done", ThisCustomer.LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success);

                    Response.Redirect("changeencryptkey.aspx");
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception exception)
            {
                ctlAlertMessage.PushAlertMessage(CommonLogic.GetExceptionDetail(exception, "<br/>"), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }
        }