Web.Configuration - migrate TryIisCustomErrors
This commit is contained in:
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public static bool TrySkipIisCustomErrors
|
||||
[UmbracoWillObsolete("Use UmbracoSettings.For<WebRouting>.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); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to try to skip IIS custom errors.
|
||||
/// </summary>
|
||||
[ConfigurationProperty(KeyTrySkipIisCustomErrors, DefaultValue = false, IsRequired = false)]
|
||||
public bool TrySkipIisCustomErrors
|
||||
{
|
||||
get
|
||||
{
|
||||
return _trySkipIisCustomErrors ?? (IsPresent
|
||||
? (bool)this[KeyTrySkipIisCustomErrors]
|
||||
: UmbracoSettings.TrySkipIisCustomErrors);
|
||||
}
|
||||
internal set { _trySkipIisCustomErrors = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<WebRouting>().TrySkipIisCustomErrors;
|
||||
}
|
||||
|
||||
if (pcr.ResponseStatusCode > 0)
|
||||
|
||||
Reference in New Issue
Block a user