5

How does DataProtectionKey work if I have nop installed on two different machines with load balancer in front.

Problem is that for now, cookie generated on first instance does not work on another instance and it logs me out.

Tried to set same DataProtectionKey for both instances also disabled automatic key generation and made this file static with expiration date in 2029 year

DataProtectionKey logic machine key in web.config

xurca
  • 2,426
  • 3
  • 24
  • 29
  • Can you show how you use the `DataProtectionKey` and the other relevant code pieces? – Stefan Oct 25 '19 at 13:22
  • Not sure, but I don't think the default behavior uses the web.config. Did you found a resource stating that? So, the folder should contain data relating to the keys, isn't it just a matter of copy/pasting that to the other system? – Stefan Oct 25 '19 at 14:22
  • the webconfig doesn't really apply to .net core – Daniel A. White Oct 25 '19 at 14:22
  • @DanielA.White: it still can be used when deploying to IIS, but I indeed also wonder if it has any relation with the data protection layer. – Stefan Oct 25 '19 at 14:24
  • https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/implementation/key-management?view=aspnetcore-3.0 – Daniel A. White Oct 25 '19 at 14:34
  • As I know in .Net core default machinekey behavior was replaced by dataprotection, but have no idea why it does not work even on same machine with 4 instances of application in same IIS. – xurca Oct 28 '19 at 08:01

0 Answers0