public ActionResult UpdateSettings(dynamic settingData) { ActionResult actionResult = new ActionResult(); try { dynamic UpdateBasicLoginSettingsRequest = JsonConvert.DeserializeObject <dynamic>(settingData.UpdateBasicLoginSettingsRequest.ToString()); dynamic UpdateRegistrationSettingsRequest = JsonConvert.DeserializeObject <dynamic>(settingData.UpdateRegistrationSettingsRequest.ToString()); Entities.UpdateSslSettingsRequest UpdateSslSettingsRequest = JsonConvert.DeserializeObject <Entities.UpdateSslSettingsRequest>(settingData.UpdateSslSettingsRequest.ToString()); actionResult = UpdateBasicLoginSettings(UpdateBasicLoginSettingsRequest); if (actionResult.HasErrors) { return(actionResult); } actionResult = UpdateRegistrationSettings(UpdateRegistrationSettingsRequest); if (actionResult.HasErrors) { return(actionResult); } actionResult = UpdateMediaSettings(settingData); if (actionResult.HasErrors) { return(actionResult); } if (UserInfo.IsSuperUser) { actionResult = UpdateGeneralSettings(settingData); } if (actionResult.HasErrors) { return(actionResult); } actionResult = UpdateSslSettings(UpdateSslSettingsRequest); } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); actionResult.AddError("", ex.Message); } return(actionResult); }
private ActionResult UpdateSslSettings(Entities.UpdateSslSettingsRequest request) { ActionResult ActionResult = new ActionResult(); try { PortalSettings PortalSettings = PortalController.Instance.GetCurrentSettings() as PortalSettings; bool PreviousValue_SSLEnabled = PortalController.GetPortalSettingAsBoolean("SSLEnabled", PortalSettings.PortalId, false); PortalController.UpdatePortalSetting(PortalSettings.PortalId, "SSLEnabled", request.SSLEnabled.ToString(), false); PortalController.UpdatePortalSetting(PortalSettings.PortalId, "SSLEnforced", request.SSLEnforced.ToString(), false); PortalController.UpdatePortalSetting(PortalSettings.PortalId, "SSLURL", AddPortalAlias(request.SSLURL, PortalSettings.PortalId), false); PortalController.UpdatePortalSetting(PortalSettings.PortalId, "STDURL", AddPortalAlias(request.STDURL, PortalSettings.PortalId), false); if (UserInfo.IsSuperUser) { HostController.Instance.Update("SSLOffloadHeader", request.SSLOffloadHeader); } if (PreviousValue_SSLEnabled != request.SSLEnabled) { foreach (KeyValuePair <int, TabInfo> t in TabController.Instance.GetTabsByPortal(PortalSettings.Current.PortalId)) { t.Value.IsSecure = request.SSLEnabled; TabController.Instance.UpdateTab(t.Value); } if (PortalSettings.Current != null && PortalSettings.Current.ActiveTab != null && !string.IsNullOrEmpty(PortalSettings.Current.ActiveTab.FullUrl)) { ActionResult.RedirectURL = PortalSettings.Current.ActiveTab.FullUrl; } else { ActionResult.RedirectURL = ServiceProvider.NavigationManager.NavigateURL(); } } DataCache.ClearPortalCache(PortalSettings.PortalId, false); } catch (Exception ex) { ActionResult.AddError("UpdateSslSettings", ex.Message); } return(ActionResult); }