Validation of ViewState Mac failed exception
生活随笔
收集整理的這篇文章主要介紹了
Validation of ViewState Mac failed exception
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Asp.net 的ViewState機制給我們帶來了很多方便,但是有時候也會產生一些莫名其妙的問題。很經常遇到的就是ViewStae的驗證出錯,以前就有遇到這樣的問題了。解決辦法都是把出現錯誤的那個頁面的EnableViewStateMac屬性設置為"false",或者干脆就在web.config里<system.web><pages>節點屬性里設置就OK了,反正也不出錯了,也沒想會不會產生安全性問題。
??? 今天又遇到了類似的問題了,異常信息也是類似的(記不太清楚了,好像是有點不一樣)提示信息是這樣的:
Exception Details: System.Web.HttpException: 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.
??? 在記錄的中文日志是說:數據無法驗證
????可是這回不一樣了,把EnableViewStateMac設為false,還不能解決問題,還會出現另一個異常提示:
The state information is invalid for this page and might be corrupted.?
??? 網上也搜出一堆這樣的問題,可是沒有更好的解釋了(就算有也看不懂)。想到是加密解密的問題,看到<pages>節點下還有一個viewStateEncryptionMode屬性,于是就把它設為
Never 。再一試,問題就解決了,不出錯了。可是不出錯了,也改了默認配置了,也不加密了,也不驗證了,那會不會產生新的,更嚴重的問題--------安全性問題?
??? 今天又遇到了類似的問題了,異常信息也是類似的(記不太清楚了,好像是有點不一樣)提示信息是這樣的:
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: 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.
??? 在記錄的中文日志是說:數據無法驗證
????可是這回不一樣了,把EnableViewStateMac設為false,還不能解決問題,還會出現另一個異常提示:
The state information is invalid for this page and might be corrupted.?
??? 網上也搜出一堆這樣的問題,可是沒有更好的解釋了(就算有也看不懂)。想到是加密解密的問題,看到<pages>節點下還有一個viewStateEncryptionMode屬性,于是就把它設為
Never 。再一試,問題就解決了,不出錯了。可是不出錯了,也改了默認配置了,也不加密了,也不驗證了,那會不會產生新的,更嚴重的問題--------安全性問題?
總結
以上是生活随笔為你收集整理的Validation of ViewState Mac failed exception的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (转) ASP.NET 2.0:使用用户
- 下一篇: 怎样才能快速批量绑定MAC与IP地址(图