Sunday, 15 January 2012

ASP.NET error when sending email: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

I came across this error after deploying a website:


Server Error in '/' Application.

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Quite a nasty looking one but with a very simple fix - just need to add the following to your web.config file in the system.web section:

 <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false"/>


Thursday, 5 January 2012

VS2010 - Ctrl + Click: Installing Microsoft Productivity Power Tools

The worst thing about developing in Java is the IDE's - Eclipse and Netbeans just don't compare to Visual Studio. However the one thing they do allow you to do is press control and click to take you to a definition - something severely lacking from VS...until now!

Productivity Power Tools is an extension for Visual Studio 2010 which contains ctrl + click among other helpful tools. To install this tool follow these steps:


  • In VS click the tools option on the toolbar, and select Extension Manager...

  • You will now be shown the extension manager dialog. Select the "Online Gallery" dialog on the left handside, and in the top right hand side search box enter "Productivity Power Tools". 

  • Press download and the download/installation process will start. Press install at the prompt. Once complete you will be notified that you need to restart VS. Press "Restart Now". 

Note that restarting VS may take a while depending on the speed of your machine. Once you restart however you'll notice if you hold down ctrl and hover over any words in your code you will get the hyperlink hand which if you click will take you to it's definition. 



Covid-19 impact on mobile applications - a quick case study

Amidst everything that's been going on over the last few months, checking on how my apps have been doing has been low down my priorities...