look for the system.web section under the root configuration node

use Element to get the root system.web. DescendantsAndSelf can return multiple
This commit is contained in:
Kevin Jump
2019-10-26 13:02:19 +01:00
committed by Sebastiaan Janssen
parent 8dd92bc720
commit 3211054063

View File

@@ -39,7 +39,8 @@ namespace Umbraco.Web.Install.InstallSteps
var fileName = IOHelper.MapPath($"{SystemDirectories.Root}/web.config");
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
var systemWeb = xml.Root.DescendantsAndSelf("system.web").Single();
// we only want to get the element that is under the root, (there may be more under <location> tags we don't want them)
var systemWeb = xml.Root.Element("system.web");
// Update appSetting if it exists, or else create a new appSetting for the given key and value
var machineKey = systemWeb.Descendants("machineKey").FirstOrDefault();