I QA’d some acceptance tests yesterday and got the old “doesn’t work on my machine”. Turns out there were some required environment settings, one of which was the machine key. Even though we have a wiki page with this info on, IMHO it’s good practise to get your tests to assert that environment conditions are met.
So here’s my quick test to ensure that the machine key is right. ( :
public void CheckMachineKey()
string devTeamValidationKey = "xxxx";
string devTeamDecryptionKey= "xxxx";
var machineKeySection = (MachineKeySection)ConfigurationManager.GetSection("system.web/machineKey");
Many thanks to this post here: Encrypt Cookie using machine key