Why does Member Members.ValidateUser return false when a user is approved and not blocked?

I know that this is similar to the other questions here, but I don’t think my business is the same as theirs.

I have a website that uses AspNetSqlMembershipProvider to validate users. I would like to use the same database from a console application. According to several articles on the Internet, I can use the System.Web.Security.Membership class from outside ASP.NET by copying the appropriate sections from web.config to app.config. This is what I did.

My console application can get the user with the requested name, and I can confirm that the user is approved and not blocked, but ValidateUser returns false for the correct pair of username and password.

I found articles in which people had problems migrating code that might be caused by a machine key mismatch, but also found a link that says the machine key is only used if the passwordFormat property is encrypted, whereas I use hashed.

The problem is that the two parts of the code - the website and the console application - are in different assemblies, and the assembly name or another property is used during password hashing? In both cases, the application name property is set to /.

Should I continue this approach or just directly access the database and the hash password itself?

+1
source share
2 answers

It turns out that the original author of the site code, which was not me, converted the entered password to upper case before using it. Since I did not know this, and my console application did not, ValidateUser correctly reported that the passwords did not match.

0
source

Take a look at this article:

http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm

Adding membership configuration settings to your app.config may help.

Hope this helps!

0
source

All Articles