diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs index 4e4b0b5801..a86992e19c 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs @@ -61,7 +61,6 @@ namespace Umbraco.Core.Configuration _useLegacySchema = null; _useDomainPrefixes = null; _umbracoLibraryCacheDuration = null; - _trySkipIisCustomErrors = null; SettingsFilePath = null; } @@ -654,23 +653,13 @@ namespace Umbraco.Core.Configuration } } - private static bool? _trySkipIisCustomErrors; - /// - /// Gets or sets a value indicating where to try to skip IIS custom errors. + /// Gets a value indicating whether to try to skip IIS custom errors. /// - public static bool TrySkipIisCustomErrors + [UmbracoWillObsolete("Use UmbracoSettings.For.TrySkipIisCustomErrors instead.")] + internal static bool TrySkipIisCustomErrors { - get - { - // default: false - return _trySkipIisCustomErrors ?? GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); - } - internal set - { - // used for unit testing - _trySkipIisCustomErrors = value; - } + get { return GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); } } /// diff --git a/src/Umbraco.Web/Configuration/WebRouting.cs b/src/Umbraco.Web/Configuration/WebRouting.cs index 0471211f31..d128c029de 100644 --- a/src/Umbraco.Web/Configuration/WebRouting.cs +++ b/src/Umbraco.Web/Configuration/WebRouting.cs @@ -10,5 +10,30 @@ namespace Umbraco.Web.Configuration [ConfigurationKey("web.routing", ConfigurationKeyType.Umbraco)] internal class WebRouting : UmbracoConfigurationSection { + private const string KeyTrySkipIisCustomErrors = "trySkipIisCustomErrors"; + + private bool? _trySkipIisCustomErrors; + + internal protected override void ResetSection() + { + base.ResetSection(); + + _trySkipIisCustomErrors = null; + } + + /// + /// Gets or sets a value indicating whether to try to skip IIS custom errors. + /// + [ConfigurationProperty(KeyTrySkipIisCustomErrors, DefaultValue = false, IsRequired = false)] + public bool TrySkipIisCustomErrors + { + get + { + return _trySkipIisCustomErrors ?? (IsPresent + ? (bool)this[KeyTrySkipIisCustomErrors] + : UmbracoSettings.TrySkipIisCustomErrors); + } + internal set { _trySkipIisCustomErrors = value; } + } } } diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index dca6a898ce..ddc1c3fad2 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -10,6 +10,7 @@ using umbraco; using umbraco.IO; using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Web.Configuration; namespace Umbraco.Web { @@ -130,7 +131,7 @@ namespace Umbraco.Web else if (pcr.Is404) { response.StatusCode = 404; - response.TrySkipIisCustomErrors = UmbracoSettings.TrySkipIisCustomErrors; + response.TrySkipIisCustomErrors = UmbracoSettings.For().TrySkipIisCustomErrors; } if (pcr.ResponseStatusCode > 0)