PasswordInfo GetPasswordInfo (string username)
{
using (DbConnection connection = CreateConnection ()) {
DbCommand command = factory.CreateCommand ();
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = @"aspnet_Membership_GetPasswordWithFormat";
AddParameter (command, "@ApplicationName", ApplicationName);
AddParameter (command, "@UserName", username);
AddParameter (command, "@UpdateLastLoginActivityDate", false);
AddParameter (command, "@CurrentTimeUtc", DateTime.Now);
// return value
AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
DbDataReader reader = command.ExecuteReader ();
if (!reader.Read ())
return null;
PasswordInfo pi = new PasswordInfo (
reader.GetString (0),
(MembershipPasswordFormat) reader.GetInt32 (1),
reader.GetString (2),
reader.GetInt32 (3),
reader.GetInt32 (4),
reader.GetBoolean (5),
reader.GetDateTime (6),
reader.GetDateTime (7));
return pi;
}
}