diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe b/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe index 710a19d1..c3ae2314 100644 Binary files a/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe and b/WebsitePanel.Installer/Sources/WebsitePanel.Installer/Updater.exe differ diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/WebPortalActionManager.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/WebPortalActionManager.cs index 7d0ccdc3..83330fff 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/WebPortalActionManager.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/WebPortalActionManager.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Text; using System.IO; using System.Xml; +using WebsitePanel.Setup.Common; namespace WebsitePanel.Setup.Actions { @@ -114,6 +115,55 @@ namespace WebsitePanel.Setup.Actions } } + public class GenerateSessionValidationKeyAction : Action, IInstallAction + { + public const string LogStartInstallMessage = "Generating session validation key..."; + + void IInstallAction.Run(SetupVariables vars) + { + try + { + Begin(LogStartInstallMessage); + + Log.WriteStart(LogStartInstallMessage); + + string path = Path.Combine(vars.InstallationFolder, "web.config"); + + if (!File.Exists(path)) + { + Log.WriteInfo(string.Format("File {0} not found", path)); + return; + } + + Log.WriteStart("Updating configuration file (session validation key)"); + XmlDocument doc = new XmlDocument(); + doc.Load(path); + + XmlElement sessionKey = doc.SelectSingleNode("configuration/appSettings/add[@key='SessionValidationKey']") as XmlElement; + if (sessionKey == null) + { + Log.WriteInfo("SessionValidationKey setting not found"); + return; + } + + sessionKey.SetAttribute("value", StringUtils.GenerateRandomString(16)); + doc.Save(path); + + Log.WriteEnd("Generated session validation key"); + InstallLog.AppendLine("- Generated session validation key"); + } + catch (Exception ex) + { + if (Utils.IsThreadAbortException(ex)) + return; + // + Log.WriteError("Site settigs error", ex); + // + throw; + } + } + } + public class CreateDesktopShortcutsAction : Action, IInstallAction { public const string LogStartInstallMessage = "Creating shortcut..."; @@ -253,6 +303,7 @@ namespace WebsitePanel.Setup.Actions new CreateWebSiteAction(), new SwitchAppPoolAspNetVersion(), new UpdateEnterpriseServerUrlAction(), + new GenerateSessionValidationKeyAction(), new SaveComponentConfigSettingsAction(), new CreateDesktopShortcutsAction() }; diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/InstallAction.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/InstallAction.cs index 36f8d2d3..80fc5bb6 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/InstallAction.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/InstallAction.cs @@ -88,8 +88,7 @@ namespace WebsitePanel.Setup SwitchServer2AspNet40, SwitchEntServer2AspNet40, SwitchWebPortal2AspNet40, - ConfigureSecureSessionModuleInWebConfig, - UpdatePortalSessionValidationKey + ConfigureSecureSessionModuleInWebConfig } public class InstallAction diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal.cs index b64297ff..cada0de3 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal.cs @@ -217,10 +217,6 @@ namespace WebsitePanel.Setup action.Description = "Updating site settings..."; page3.Actions.Add(action); - action = new InstallAction(ActionTypes.UpdatePortalSessionValidationKey); - action.Description = "Generate session validation key..."; - page3.Actions.Add(action); - action = new InstallAction(ActionTypes.UpdateConfig); action.Description = "Updating system configuration..."; page3.Actions.Add(action); diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs index 301dc11a..9db3a3c7 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs @@ -260,9 +260,6 @@ namespace WebsitePanel.Setup break; case ActionTypes.ConfigureSecureSessionModuleInWebConfig: ConfigureSecureSessionModuleInWebConfig(); - break; - case ActionTypes.UpdatePortalSessionValidationKey: - UpdatePortalSessionValidationKey(); break; } } @@ -2657,44 +2654,6 @@ namespace WebsitePanel.Setup } } - private void UpdatePortalSessionValidationKey() - { - try - { - string installFolder = Wizard.SetupVariables.InstallationFolder; - string path = Path.Combine(installFolder, "web.config"); - - if (!File.Exists(path)) - { - Log.WriteInfo(string.Format("File {0} not found", path)); - return; - } - - Log.WriteStart("Updating configuration file (session validation key)"); - XmlDocument doc = new XmlDocument(); - doc.Load(path); - - XmlElement sessionKey = doc.SelectSingleNode("configuration/appSettings/add[@key='SessionValidationKey']") as XmlElement; - if (sessionKey == null) - { - Log.WriteInfo("SessionValidationKey setting not found"); - return; - } - - sessionKey.SetAttribute("value", StringUtils.GenerateRandomString(16)); - doc.Save(path); - Log.WriteEnd("Updated configuration file"); - InstallLog.AppendLine("- Updated session validation key in the configuration file"); - } - catch (Exception ex) - { - if (Utils.IsThreadAbortException(ex)) - return; - Log.WriteError("Configuration file update error", ex); - throw; - } - } - private void SetServiceSettings() { try