2008-12-01 267 views
1

我目前收到此錯誤:驗證失敗

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.

我發現這個錯誤多種解決方案。我們目前使用的解決方案是在機器級別添加靜態MachineKey字段,並使用靜態驗證密鑰和解密密鑰。

<MachineKey validationKey="" decryptionKey="" validation="SHA1" decruption="AES" /> 

此解決方案是否適用於.NET 3.5?有沒有更優雅的解決方案?

回答

2

您的web應用程序是否託管在webfarm中?

如果是這樣,原因是服務器1呈現頁面並將其發佈到服務器2.因此,機器密鑰不同,驗證失敗。

它也適用於ASP.NET 3.5。