// Inherited from MembershipProvider ==> Forwarded to previous provider if this provider hasn't been initialized public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) { if (!InitializeCalled) { return(PreviousProvider.GetUser(providerUserKey, userIsOnline)); } throw new NotSupportedException(); }
// Inherited from MembershipProvider ==> Forwarded to previous provider if this provider hasn't been initialized public override MembershipUser GetUser(string username, bool userIsOnline) { if (!InitializeCalled) { return(PreviousProvider.GetUser(username, userIsOnline)); } // Due to a bug in v1, GetUser allows passing null / empty values. using (var db = ConnectToDatabase()) { int userId = GetUserId(db, SafeUserTableName, SafeUserNameColumn, SafeUserIdColumn, username); if (userId == -1) { return(null); // User not found } return(new MembershipUser(Membership.Provider.Name, username, userId, null, null, null, true, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue)); } }
// Inherited from MembershipProvider ==> Forwarded to previous provider if this provider hasn't been initialized public override MembershipUser GetUser(string username, bool userIsOnline) { if (!InitializeCalled) { return(PreviousProvider.GetUser(username, userIsOnline)); } if (username.IsEmpty()) { ExceptionHelper.CreateArgumentNullOrEmptyException("username"); } using (var db = ConnectToDatabase()) { int userId = GetUserId(db, SafeUserTableName, SafeUserNameColumn, SafeUserIdColumn, username); if (userId == -1) { return(null); // User not found } return(new MembershipUser(Membership.Provider.Name, username, userId, null, null, null, true, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue)); } }
// Inherited from MembershipProvider ==> Forwarded to previous provider if this provider hasn't been initialized public override MembershipUser GetUser(string username, bool userIsOnline) { if (!InitializeCalled) { return(PreviousProvider.GetUser(username, userIsOnline)); } MembershipAccount user; try { user = GetUser(username); } catch (Exception ex) { return(null); } return(new MembershipUser(Membership.Provider.Name, username, user.UserId, null, null, null, true, false, DateTime.MinValue, user.LastLoginDate ?? DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue)); }