public static string HashPassword(string password)
{
var provider = new SHA1CryptoServiceProvider();
var encoding = new UnicodeEncoding();
var hash= provider.ComputeHash(encoding.GetBytes(password));
return Convert.ToBase64String(hash);
}
var pwdstr=HashPassword(password);
var user=(from u in context.Users
where u.UserName.Equals(username) && u.pwd.Equals(pwdstr)
select u);
This is simple way to set and check password stored in database.Hope it will helpful.To store in a database use first method and to compare use second method.Until next post cheers!!!