Tag Archives: asp-net

My fix for “Validation of viewstate MAC failed” error in IE

Once again, I have cursed the IE team repeatedly… I am ashamed to work on web applications knowing that I have to support such a pile of shit. 

Ranting aside, I ran into an IE only issue with asp.net.  Specifically, I was getting “Validation of viewstate MAC failed” that has randomly plagued developers for years.  My issue arose for a page that has an asp.net gridview and some other controls that do an autopostback.  My page would completely load, but whenever I posted back (form submits worked, however), the app would crash in IE.  Searching the internet didn’t really yield much information and all the “solutions” didn’t fix my problem.  Well, it turns out that I had a nested form within my asp.net form (the main one with runat=”server”).  Removing the nested form fixed the issue.  I’d suggest that if you’re running into the same error, examine your markup, as firefox tends to be more lenient.