Geeks With Blogs
Michael Holland

I have been developing an MVC3 application with the intention of deploying to the Cloud. It was configured to use Forms Authentication with SQL Membership on SQL Azure.

Everything seemed to be working perfectly locally, but after I deployed the Membership.ValidateUser no longer seemed to work. I could use the Providers to get information from the database (e.g. Membership.GetUser would return an existing account) which meant the database connection was fine and user existed, just the validation failed.

After a bit of hunting I found the solution to the problem.

Cause: The default Hashing algorithm type on Azure is SHA1 - my Windows 7 default is HMACSHA256.

Symptom: The password decryption will fail when deployed to Azure causing the Membership.ValidateUser to return false.

Solution: Add the hashAlgorithmType="HMACSHA256" attribute to the membership element in your web.config file. It is recommended you also add passwordFormat="Hashed" to the DefaultMembershipProvider (details in the links below).

Configuration details:

http://www.codeproject.com/KB/aspnet/LoginControlError.aspx

Provider details:

http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx

Posted on Wednesday, October 19, 2011 9:51 AM | Back to top


Comments on this post: Deployed Azure ValidateUser failing

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © LEV | Powered by: GeeksWithBlogs.net | Join free