I am using code like this to list all users:
foreach (UserInfo ui in UserController.GetUsers(PortalId))
{
// Sneakily get password
MembershipUser thisUser = Membership.GetUser(ui.Username);
string thisPwd = "";
if( thisUser!=null) thisPwd = thisUser.GetPassword();
}
In DNN 4.7 this works fine. In DNN 4.8 exception "Bad Data" is thrown:
at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone)
at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.Security.MembershipProvider.DecryptPassword(Byte[] encodedPassword)
at System.Web.Security.MembershipProvider.UnEncodePassword(String pass, Int32 passwordFormat)
at System.Web.Security.SqlMembershipProvider.GetPassword(String username, String passwordAnswer)
at System.Web.Security.MembershipUser.GetPassword(String passwordAnswer)
at ASP.JCshowUserDetails.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\DNN480\DesktopModules\phdcc.Data.View\JCshowUserDetails.ascx:line 24
Any ideas?