gpt4 book ai didi

asp.net-mvc - 升级到 .NET 3.5 SP1 后 Html.AntiForgeryToken() 导致错误

转载 作者:行者123 更新时间:2023-12-01 22:35:12 26 4
gpt4 key购买 nike

我刚刚更新到 .NET 3.5 SP1,我曾经工作的 ASP.NET MVC 页面现已停止工作。

当尝试加载页面时,我收到以下 YSOD

[CryptographicException: Padding is invalid and cannot be removed.]
System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) +7596702
System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +208
System.Security.Cryptography.CryptoStream.FlushFinalBlock() +33
System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +225
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +195

[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
ViewState: hC6BC8KsuD/yoy2iG74bUZ8TYhGfuDDeIjh9fg/L18yr/E+1Nk/pjS5gyn9O+2jY
Referer: http://localhost:1092/admin/product
Path: /admin.aspx/product/edit/4193]

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +242
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.Mvc.AntiForgeryTokenSerializer.Deserialize(String serializedToken) +73

如果我删除该行

<%= Html.AntiForgeryToken() %>

一切又恢复正常了,有什么想法可能会导致这种情况吗?如果这是 MVC 或 .NET 问题,我希望能更幸运地找到解决方案,所以我猜这与我的配置有关。

我尝试重新安装 MVC 框架,看看是否是因为我在 SP1 之前安装的,但仍然遇到同样的问题。 Google 和 SO 搜索尚未得出任何确定的结论。

最佳答案

哦,刚刚解决了。

清除了我的浏览器缓存和 cookie,一切又恢复正常了。

关于asp.net-mvc - 升级到 .NET 3.5 SP1 后 Html.AntiForgeryToken() 导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/536739/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com