Eapen
Eapen

Reputation: 82

how purpose string array of IDataProtectionProvider taking default value as physical path of project?

As in the below picture the Purposes string of IDataProtectionProvider is taking default values of my project physical root path. My problem is when i encrypt data from my local host and the same cannot be accessed from another machine as the key of IDataProtectionProvider is my local host path.

enter image description hereHow to disable the auto generated purpose key in IDataProtectionProvider. I found one here. But when i try to decrypt the data. it saying no key found. Please help me guys.

Upvotes: 5

Views: 1171

Answers (1)

Mikkel
Mikkel

Reputation: 196

I had the same issue as OP. In my case it was because of the default ApplicationDescriminator.

services
   .AddDataProtection(o => {
       o.ApplicationDiscriminator = "WhatYouWant";
   }
);

When I change it, the default path will be overridden. Setting it to "" will remove it entirely.

But it seems like a good feature to have so I would keep it.

Hope this can help people in the future.

Upvotes: 7

Related Questions