FAQ: How do I create a machine key?
Version: AbleCommerce Asp.Net
Last Update: 11/22/17
When should I create a machine key? My website is running in "medium trust" and I'm receiving viewstate errors.
In most cases, you will NOT have to create a machine key. This is generally required if you are hosted in a "medium" trust environment. You may be experiencing symptoms like having to continuously login more than once in a 20 minute standard session. You may also experience MAC validation errors like the example below.
Validation of viewstate MAC failed. If this application is hosted by a web farm or cluster, ensure that machine key configuration specifies the same validation algorithm. Autogenerate cannot be used in a cluster.
If this happens, you can follow the steps in the section below, "Creating a Machine Key". It some cases, this still may not solve the viewstate errors, in which case, you may need to disable viewstate for the application or for a single page.
How does the "viewstate" error happen?
One way this can happen is if a person clicks something on the
page before the page is totally loaded up. That can sometimes
be the reason it happens sporadically. To expand on what
might be the cause, it's a known problem with ASP.NET.
The view state validation information is put at the end of the
output by Microsoft. So if you have a page that takes a second
or two to fully load up, the browser might already be showing
the parts of the page it knows about. That might include buttons
or links. So if the person viewing the site clicks on things before
the browser has fully loaded the viewstate information, it sends
a request back to the server without it.