ASP.NET ‘Validation of viewstate MAC failed’. error SOMETIMES on button click

It’s a personal-site on goDaddy. The aspx/cs exist on a sub-folder of the root directory (‘httpdocs/test’). It seems as though, if the button is clicked immediately, there is no error. If there is a 60/120 second waiting period until the button is clicked, the exception is thrown every time.

From many comments that I’ve seen on StackOverflow & other sites, webfarm or cluster may be confused on where to the PostBack to should return to.

I never get any exceptions thrown, when clicking on the button when tested here my ‘localhost’.

Thank you in advance for any suggestions.

default.aspx:

<%@ page inherits="visits" codefile="visits.cs"  %>
<!doctype html>
<html>
    <body>
        <form runat="server">
            <asp:button runat="server" onClick='clickMe' />
        </form>
    </body>
</html>

visits.cs:

using System;

partial class visits:System.Web.UI.Page
{
    protected void Page_Load(object o, EventArgs ea)
    {}

    public void clickMe(object o, EventArgs ea)
    {}
}

I would expect to be able to click that button at anytime, from now to eternity, without a ‘Server’ exception popping up occasionally.

This was obviously a stripped-down version of a more elaborate page/application. This is about as simplistic/succinct derivation of the actual page that I can present to my friends at StackOverflow.

I’m just confused. I assume that I could attempt a try/catch on the Javascript button click. I’m not sure how to do that though.

Leave a Comment