locked
Validation of viewstate MAC failed - Encryption key lifetime RRS feed

  • Question

  • User-595553099 posted

    Hi all

    One of our users received this error a couple of days ago on one of our web systems and lost a lot of work so I am trying to track it down to ensure it doesnt happen again.  During my research I found a couple of blogs saying that the encryption key used by the server only lasts till the next recycle.

    I have tried to reproduce the error by opening the page, recycling the app pool, and then submitting but everything works normally.

    Can anybody tell me under what circumstances IIS running on a Windows 2008 (Note! not R2) server will change the encryption key and thus cause this error.

    Thanks in advance
    Brian

    Sunday, April 14, 2013 10:49 PM

Answers

  • User1779161005 posted

    The information you've read is inaccurate -- it is not a feature of IIS to generate new encryption keys on each recycle. Only major changes wuch as website and app names would have this effect. But if you are experiencing key issues, it wouldn't hurt to set an explicit key via <mackineKey>

    http://msdn.microsoft.com/en-us/library/ff649308.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2013 9:12 AM

All replies

  • User1124521738 posted

    I don't know about your infrastructure, but if you are in a load balanced environment, you could be seeing this when and it rolls between server A and server B, and in those cases, you'll need to do some machine key copies amogst the whole farm http://msdn.microsoft.com/en-us/library/ff649308.aspx#paght000007_webfarmdeploymentconsiderations

    Sunday, April 14, 2013 11:55 PM
  • User-595553099 posted

    Hi ninianne98,

    Sorry, I should have stated that this is a standalone server.  No load balancing, no farm. Just a Windows 2008 server.  We have tried to force it to change its key but we can't.  We have recycled the app pool, stopped and started the web site, even restarted the server.  We did get a failure on postback after the server restart but not a MAC failure. 

    We have also checked and the server does not have a static encyption key in the machine.config and it is a new default install of a 2008 server.

    Thanks again for any help.

    Monday, April 15, 2013 1:27 AM
  • User1779161005 posted

    The information you've read is inaccurate -- it is not a feature of IIS to generate new encryption keys on each recycle. Only major changes wuch as website and app names would have this effect. But if you are experiencing key issues, it wouldn't hurt to set an explicit key via <mackineKey>

    http://msdn.microsoft.com/en-us/library/ff649308.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2013 9:12 AM
  • User-595553099 posted

    Thanks for clearing that up.

    In that case, I will have to assume that the Internet Explorer 8 session on the clients PC somehow corrupted the view state information.

    Thanks again
    Brian

    Monday, April 15, 2013 4:33 PM