Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created an ASP.NET-based relying party application and this application is deployed on farm-server where load balancing is enabled and sticky session is also used.

When request come from single server in that time its working fine but during the post back if request server is changed in that time it throws an exception "Key not valid for use in specified state".

I have tried to set same machine key on both server but still facing same problem.

I have found on net the alternative solution is set enableViewStateMac="false".

Can i use this, and what is demerit of this?

share|improve this question
How is your session state stored? See Scott Hanselman's post for different options. – James Skemp Jun 3 '11 at 12:11

To answer your question, according to MSDN:

This attribute should never be set to false in a production Web site.

(Of course, the default is also false ...) Which suggests to me that you want to be very careful doing this.

Can you include a link to the resource you found online that suggested you switch this off?

Next, according to an MSDN blog:

The problem is that if a POST back is performed and goes to a different server, you will get a nice little error message saying “Corrupt View State“.

To fix this, you can either set enableViewStateMac to false in the element or specify a common value for the validationKey attribute in the element across all servers (in the farm).

Which suggests to me that, unless the error message has changed (quite possible), this isn't what you're running into.

Take a look at this accepted answer - - over on Stack Overflow to make sure you're setup correctly.

MSDN also has an article ASP.NET Session State Overview that discusses setting up session state.

At this point, I think it's a configuration issue. Changing machine.config should have restarted the app pools, so that's probably not the issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.