ASP.NET Core 防伪机制 Anti-Forgery 解析:从原理到实战应用

本文系统讲解 ASP.NET Core 中 Anti-Forgery(防伪)机制的原理、默认行为、配置选项及在 MVC、Razor Pages、Minimal APIs 中的实战应用,帮助开发者全面理解并正确使用 CSRF 防护。

2025-11-14 398 0 ASP.NET Core Anti-Forgery

The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster怎么解决?

The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the <machineKey> configuration specifies explicit encryption and validation keys.

2023-03-08 2425 0 anti-forgery not be decrypted hosted by machineKey

ASP.NET Core MVC/RazorPage使用Anti-Forgery Tokens进行XSRF/CSRF防护

ASP.NET Web Stack运行时使用同步器令牌模式的变体来抵御XSRF攻击。同步器令牌模式的一般形式是,除了身份验证令牌):一个令牌作为Cookie,另一个作为表单值,两个反XSRF令牌提交到服务器。服务器在两个令牌通过比较检查时才允许请求继续。

2022-12-06 2345 0 CSRF 跨站点请求伪造 ASP.NET Core MVC Anti-Forgery

最新评论
顶部