forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigUtil.cs
More file actions
44 lines (38 loc) · 1.57 KB
/
ConfigUtil.cs
File metadata and controls
44 lines (38 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Configuration;
namespace WebMatrix.WebData
{
internal static class ConfigUtil
{
private static bool _simpleMembershipEnabled = IsSimpleMembershipEnabled();
public static bool SimpleMembershipEnabled
{
get { return _simpleMembershipEnabled; }
}
private static bool IsSimpleMembershipEnabled()
{
string settingValue = ConfigurationManager.AppSettings[WebSecurity.EnableSimpleMembershipKey];
bool enabled;
if (!String.IsNullOrEmpty(settingValue) && Boolean.TryParse(settingValue, out enabled))
{
return enabled;
}
// Simple Membership is enabled by default, but attempts to delegate to the current provider if not initialized.
return true;
}
internal static bool ShouldPreserveLoginUrl()
{
string settingValue = ConfigurationManager.AppSettings[FormsAuthenticationSettings.PreserveLoginUrlKey];
bool preserveLoginUrl;
if (!String.IsNullOrEmpty(settingValue) && Boolean.TryParse(settingValue, out preserveLoginUrl))
{
return preserveLoginUrl;
}
// For backwards compatible with WebPages 1.0, we override the loginUrl value if
// the PreserveLoginUrl key is not present.
return false;
}
}
}