我不使用會話,所以我將它與所有不需要的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