Server Error in '/' Application.

Invalid length for a Base-64 char array or string.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Invalid length for a Base-64 char array or string.

Source Error:


Line 20:         string EncryptionKey = "hyddhrii%2moi43Hd5%%";
Line 21:         cipherText = cipherText.Replace(" ", "+");
Line 22:         byte[] cipherBytes = Convert.FromBase64String(cipherText);
Line 23:         using (Aes encryptor = Aes.Create())
Line 24:         {

Source File: d:\inetpub\vhosts\shadantrading.com\goldenmeal.jo\OneBranch.aspx.cs    Line: 22

Stack Trace:


[FormatException: Invalid length for a Base-64 char array or string.]
   System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) +689
   System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +120
   System.Convert.FromBase64String(String s) +38
   Branches.Decrypt(String cipherText) in d:\inetpub\vhosts\shadantrading.com\goldenmeal.jo\OneBranch.aspx.cs:22
   Branches.Page_Load(Object sender, EventArgs e) in d:\inetpub\vhosts\shadantrading.com\goldenmeal.jo\OneBranch.aspx.cs:46
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2857


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0