我不使用会话,所以我将它与所有不需要的HTTP模块一起删除。AntiForgeryToken是否需要会话状态?
我有时会收到此错误:System.Web.Mvc.HttpAntiForgeryException: 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. AutoGenerate cannot be used in a cluster.
或者这一个:System.Web.Mvc.HttpAntiForgeryException: The provided anti-forgery token was meant for a different claims-based user than the current user.
当我启动了会话,它的工作原理。
所以问题是:csrf的东西是否依赖于会话状态?
您确定您的共享托管供应商仅在一台Web服务器上托管您的应用程序吗? – lowleveldesign
@lowleveldesign我不确定。但相当确信,因为主机名在我的日志中始终是一样的,就像IP一样。 –
以及设置csrf cookie的域名?你在使用你独特的子域名吗?否则,您的应用程序可能会从运行在同一根域中的其他.NET应用程序接收Cookie。 – lowleveldesign