Skip to content

Commit ed9bd5f

Browse files
Update key persistence location for data protection configuration
1 parent 5748830 commit ed9bd5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ public static void AddGrandDataProtection(this IServiceCollection services, ICon
121121
{
122122
var securityConfig = new SecurityConfig();
123123
configuration.GetSection("Security").Bind(securityConfig);
124+
var defaultKeyPath = Path.Combine(AppContext.BaseDirectory, "App_Data", "DataProtectionKeys");
124125
var keyPersistenceLocation = string.IsNullOrEmpty(securityConfig.KeyPersistenceLocation)
125-
? "/App_Data/DataProtectionKeys" : securityConfig.KeyPersistenceLocation;
126+
? defaultKeyPath
127+
: securityConfig.KeyPersistenceLocation;
126128
var dataProtectionKeysFolder = new DirectoryInfo(keyPersistenceLocation);
127129
//configure the data protection system to persist keys to the specified directory
128130
services.AddDataProtection().PersistKeysToFileSystem(dataProtectionKeysFolder);

0 commit comments

Comments
 (0)