make Registry subkey writable (#21342)

If not writable, sometimes you will suffer `UnauthorizedAccessException: Cannot write to the registry key.` I think a wide used docs should avoid that happen.
pull/21352/head
Ruikuan 2021-01-29 05:30:11 +08:00 committed by GitHub
parent 343603f3ac
commit 01de92107f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ Sometimes the app might not have write access to the file system. Consider a sce
public void ConfigureServices(IServiceCollection services)
{
services.AddDataProtection()
.PersistKeysToRegistry(Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Sample\keys"));
.PersistKeysToRegistry(Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Sample\keys", true));
}
```