private static string FixUsername(string username) { //Since the hashPassword function is case sensitive, recv the real thing from db. //HACK, this needs password recovery to be solved. using(Db db = new Db()) { db.CommandText = "SELECT username FROM tMember WHERE lower(username) = @username"; db.AddParameter("@username", username); username = db.ExecuteScalar() as string; return username; } }