.Net Core 3.0

warn: Microsoft.AspNetCore.Session.SessionMiddleware[7]
Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The payload was invalid.
at Microsoft.AspNetCore.DataProtection.Cng.CbcAuthenticatedEncryptor.DecryptImpl(Byte* pbCiphertext, UInt32 cbCiphertext, Byte* pbAdditionalAuthenticatedData, UInt32 cbAdditionalAuthenticatedData)
at Microsoft.AspNetCore.DataProtection.Cng.Internal.CngAuthenticatedEncryptorBase.Decrypt(ArraySegment`1 ciphertext, ArraySegment`1 additionalAuthenticatedData)
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)

漏加了 services.AddDataProtection()

public void ConfigureServices(IServiceCollection services)
{ services.AddSession();
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection")); services.AddRazorPages().AddRazorRuntimeCompilation();
services.AddControllersWithViews();
} public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseStatusCodePagesWithReExecute("/Home/Error");
} app.UseSession();
}

Error unprotecting the session cookie.The payload was invalid.的更多相关文章

  1. Redis+Django(Session,Cookie)的用户系统

    一.Django authentication django authentication提供了一个便利的user api接口,无论在py中 request.user,参见Request and re ...

  2. Redis+Django(Session,Cookie、Cache)的用户系统

    转自 http://www.cnblogs.com/BeginMan/p/3890761.html 一.Django authentication django authentication 提供了一 ...

  3. 第一篇 Flask基础篇之(配置文件,路由系统,模板,请求响应,session&cookie)

    Flask是一个基于Python开发并且依赖jinja2模板和Werkzeug WSGI服务的一个微型框架,对于Werkzeug本质是Socket服务端,其用于接收http请求并对请求进行预处理,然后 ...

  4. 认证 协议 JWT OAuth Session Cookie

    本文翻译自Auth-Boss. 如果有翻译的不恰当或不对的地方, 欢迎指出. 成为一个认证老司机, 了解网络上不同的身份认证方法. 本文档的目的是记录和编目Web上的身份验证方法.认证指的是创建一个系 ...

  5. session & cookie(li)

    Session & Cookie 一.定义 Session,用户在浏览某个网站时,从进入网站到浏览器关闭所经过的这段时间,也就是用户浏览这个网站所花费的时间.Cookie,由服务器端生成,发送 ...

  6. web也是区分前端与后端的,session\cookie辨析

    <1>Ajax交互方式 Ext.Ajax.request( { //被用来向服务器发起请求默认的url url : "", //请求时发送后台的参数,既可以是Json对 ...

  7. 浅析session&cookie

    session&cookie没有出现的黑暗时代 大家都知道,HTTP协议是一种无状态的协议,本次请求下一次请求没有任何的关联,所有没有办法直接用http协议来记住用户的信息,试想一向,每一次点 ...

  8. http之Session&Cookie

    百度了一波session与Cookie,我发现这东西远比我想象中更复杂(可能是因为我不明白底层的运行原理).网上也是一堆的关于Session与Cookie区别/联系的文章,然而,我看完了还是一脸懵逼的 ...

  9. Asp.net MVC使用Model Binding解除Session, Cookie等依赖

    上篇文章"Asp.net MVC使用Filter解除Session, Cookie等依赖"介绍了如何使用Filter来解除对于Session, Cookie的依赖.其实这个也可以通 ...

  10. Asp.net MVC使用Filter解除Session, Cookie等依赖

    本文,介绍了Filter在MVC请求的生命周期中的作用和角色,以及Filter的一些常用应用场景. 同时针对MVC中的对于Session,Cookie等的依赖,如何使用Filter解依赖. 如果大家有 ...

随机推荐

  1. centOS7 防火墙基本操作

    一.防火墙的开启.关闭.禁用命令 (1)设置开机启用防火墙:systemctl enable firewalld.service (2)设置开机禁用防火墙:systemctl disable fire ...

  2. 【pwn】[SWPUCTF 2022 新生赛]InfoPrinter--格式化字符串漏洞,got表劫持,data段修改

    下载附件,checksec检查程序保护情况: No RELRO,说明got表可修改 接下来看主程序: 函数逻辑还是比较简单,14行出现格式化字符串漏洞,配合pwntools的fmtstr_payloa ...

  3. 题解 CF980B

    前言: 关于原题目中的 "旅馆" 这一用词,个人感觉用起来十分不畅,于是下文中将会用 "障碍物" 一词来代指旅馆. 题目大意: 有一座 \(4 \times n ...

  4. js判断字符串数据类型

    mounted() { this.isJSON('{"key":1232,"a":2},{"key":1232,"a": ...

  5. C#12新功能有哪些?

    前言 作为.NET 8发布会的一部分,微软于11月14日发布了C#12的新功能,这也是目前.NET的最新版本.正如之前公布的那样,最显著的改进包括了集合表达式.主构造函数.任何类型的别名以及lambd ...

  6. Cplex学术版申请及Python API环境配置

    当使用Cplex时弹出下面错误: CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at http ...

  7. [ABC244G] Construct Good Path

    Problem Statement You are given a simple connected undirected graph with $N$ vertices and $M$ edges. ...

  8. Find a Number (记忆化+BFS)

    题目来自"2018-2019 ICPC, NEERC, Southern Subregional Contest",codeforces上放置了此题:Find a Number 题 ...

  9. 数字孪生结合GIS能够为城市灾害预防工作提供什么帮助?

    数字孪生技术结合GIS(地理信息系统)在城市灾害预防工作中发挥着重要的作用,为城市的安全和可持续发展提供了关键帮助.数字孪生是一种将现实世界与数字虚拟世界相结合的技术,可以帮助城市规划者和管理者更好地 ...

  10. mybatis测试类的书写步骤

    mybatis测试类的书写步骤 private SqlSession session; @Test //* 1.根据UserMapper接口的Class对象获取Mapper接口类型的对象 //* 2. ...