I am running DNN 9.1.1. When I go to Settings -> Servers -> Server Settings tab -> SMTP Server tab to adjust the SMTP settings, my DNN site is throwing this error:
System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.CapiSymmetricAlgorithm.DepadBlock(Byte block, Int32 offset, Int32 count)
at System.Security.Cryptography.CapiSymmetricAlgorithm.TransformFinalBlock(Byte inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
at DotNetNuke.Security.FIPSCompliant.DecryptAES(String encryptedText, String passPhrase, String salt, Int32 iterations)
at Dnn.PersonaBar.Servers.Services.ServerSettingsSmtpHostController.GetSmtpSettings() in C:\soruce location\PB.Ext\src\Modules\Settings\Dnn.PersonaBar.Servers\Services\ServerSettingsSmtpHostController.cs:line 69
I have SMTP setup at the Global level only. I debugged the PersonaBar Servers module and in the getSmtpSettings() method, it is checking for portalId (see the code below), which it is returning 0.
var portalId = PortalSettings.Current.PortalId;
Further down in the code, SMTP password for the particular portal is being retrived (see below), which is throwing the above error. If I change the portalId to 1 and it works fine and returns an empty string.
smtpPassword = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey())
And, here is the URL the portal UI is using to retrive the SMTP settings:
Ok, my questions, why is the code even trying to get the password for portal 0, which doesn't exist? Is my config messed up somewhere where it is ruturning 0 for PortalSettings.Current.PortalId? How do I get the page loading correctly? Any help would be greatly apprecaited.