diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs index f59e7ef0963..5ba9d72314b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs @@ -319,11 +319,11 @@ public HttpResponseMessage GetDefaultPagesSettings(int? portalId, string culture } var portal = PortalController.Instance.GetPortal(pid, cultureCode); - var localizedPortalSettings = PortalController.Instance.GetPortalSettings(portal.PortalID, cultureCode); + var localizedPortalSettings = PortalController.Instance.GetPortalSettings(pid, cultureCode); - int redirectAfterLoginTabId = int.TryParse(localizedPortalSettings["Redirect_AfterLogin"], out redirectAfterLoginTabId) ? redirectAfterLoginTabId : -1; - int redirectAfterLogoutTabId = int.TryParse(localizedPortalSettings["Redirect_AfterLogout"], out redirectAfterLogoutTabId) ? redirectAfterLogoutTabId : -1; - int redirectAfterRegistrationTabId = int.TryParse(localizedPortalSettings["Redirect_AfterRegistration"], out redirectAfterRegistrationTabId) ? redirectAfterRegistrationTabId : -1; + int redirectAfterLoginTabId = this.GetLocalizedTabIdSetting(localizedPortalSettings, "Redirect_AfterLogin"); + int redirectAfterLogoutTabId = this.GetLocalizedTabIdSetting(localizedPortalSettings, "Redirect_AfterLogout"); + int redirectAfterRegistrationTabId = this.GetLocalizedTabIdSetting(localizedPortalSettings, "Redirect_AfterRegistration"); return this.Request.CreateResponse(HttpStatusCode.OK, new { @@ -3582,5 +3582,17 @@ private int ValidateTabId(int tabId, int portalId) var tab = TabController.Instance.GetTab(tabId, portalId); return tab != null && !tab.IsDeleted ? tab.TabID : Null.NullInteger; } + + private int GetLocalizedTabIdSetting(Dictionary localizedPortalSettings, string settingKey) + { + var settingValue = string.Empty; + if (localizedPortalSettings.TryGetValue(settingKey, out settingValue)) + { + int tabId = int.TryParse(settingValue, out tabId) ? tabId : -1; + return tabId; + } + + return -1; + } } }