Donald
Donald

Reputation: 633

How to solve error unprotecting the session cookie

I am getting the following warnings, AFAIK this is related to cookies and GDPR, please CMIIW..

how to solve this? need help.. thanks a lot in advance

Regards Don

    public void ConfigureServices(IServiceCollection services)
    {
        services.Configure<CookiePolicyOptions>(options =>
        {
            options.CheckConsentNeeded = context => true;
            options.MinimumSameSitePolicy = SameSiteMode.None;
        }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        ...
        ... 
        app.UseStaticFiles();
        app.UseCookiePolicy();

[WRN] Error unprotecting the session cookie. System.Security.Cryptography.CryptographicException: The key {833d40c6-95a9-4d70-9f1c-b5024726a65c} was not found in the key ring. at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)

Upvotes: 2

Views: 7916

Answers (1)

Jay
Jay

Reputation: 274

unprotecting the session cookie

I had the same issue, thing is your site cookie is old and do not match with the current site, its key is different,

happens only due to the new source release and the user being with old source cookies.

Try removing cookie first and then try, it will disappear

Upvotes: 2

Related Questions