Base solution for your next web application
Open Closed

The input is not a valid Base-64 string #4065


User avatar
0
fguo created

I am running Core + Angular v4.5.0. When a new user register, it pops up an "internal error". The log shows an error on AccountAppService as below. I also found the same thing happens while I access "settings" in Admin page. The log shows same error on TenantSettingsAppService. Please advise!

Here is the error on Log:

System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)

at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)

at System.Convert.FromBase64String(String s)

at Abp.Runtime.Security.SimpleStringCipher.Decrypt(String cipherText, String passPhrase, Byte[] salt)

at SNet.Emailing.SNetSmtpEmailSenderConfiguration.get_Password()

at Abp.MailKit.DefaultMailKitSmtpBuilder.ConfigureClient(SmtpClient client)

at Abp.MailKit.DefaultMailKitSmtpBuilder.Build()

at Abp.MailKit.MailKitEmailSender.BuildSmtpClient()

at Abp.MailKit.MailKitEmailSender.<SendAsync>d__2.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__4.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at SNet.Authorization.Users.UserEmailer.<ReplaceBodyAndSend>d__18.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at SNet.Authorization.Users.UserEmailer.<SendEmailActivationLinkAsync>d__9.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices...


6 Answer(s)
  • User Avatar
    0
    soonjoo created

    I got this issue when i upgraded the framework version from 4.4 to 4.5... I fixed it by going to the database, and running this command.

    DELETE FROM [AbpSettings] WHERE Name = 'Abp.Net.Mail.Smtp.Password'
    

    then log in to the website as host and set the email password again.

    The reason is because in the newer version, Abp.Net.Mail.Smtp.Password is being hashed.

  • User Avatar
    0
    alirizaadiyahsi created

    Hi @soonjoo,

    Good to hear you solved the problem. We have also mentioned this error on the issue: [https://github.com/aspnetzero/aspnet-zero-core/issues/194#issuecomment-316058671])

  • User Avatar
    0
    fguo created

    @soonjoo:

    Thank you! It solved my issue. There is a fake password record. I just deleted it, and the error gone.

    However, I realized my SMTP not working on v4.5. It worked on v4.0, and I've never changed the settings since then. After some try-and-see, I think the v4.5 does not support "Anonymous Access". I have to uncheck this option in the IIS SMTP Authentication section. But, if I use "Basic Authentication" option in SMTP, I always get "AuthenticationInvalidCredentials: 5.7.3 Authentication unsuccessful" exception, no matter what credentials I enter. My SMTP stores a credential in "Outbound Security", but it seems not working with aspnet zero.

    The only working way is using "Integrated Windows Authentication" option to access SMTP in IIS and use a domain administrator's credential in aspnet zero. It is not good however. The domain administrator's credential should not be exposed to any other people.

    Can you suggest me how do you set your SMTP in IIS and aspnet zero?

    Thanks again!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @fguo,

    Do you use .Net Core or .Net Framework 4.6.1 ?

  • User Avatar
    0
    fguo created

    .Net Framework 4.6.1.

    BTW, Our SMTP on IIS is shared by several applications, so I have no too much freedom to adjust its settings. I think it is a popular scenario. Is it possible for ASPNET Zero to inherit all settings from the SMTP on host? For example, on Administration>Settings>Email (SMTP) page, if any setting value keeps blank, use the value on SMTP host by default.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @fguo,

    It is possible but in AspNet Zero, we didn't implement it like that. When you save email settings on Tenant Settings page, all settings are saved to database even if it is empty.

    So, you can change this logic if you want.