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 34:         string EncryptionKey = "MAKV2SPBNI99212";
Line 35:         cipherText = cipherText.Replace(" ", "+");
Line 36:         byte[] cipherBytes = Convert.FromBase64String(cipherText);
Line 37:         using (Aes encryptor = Aes.Create())
Line 38:         {

Source File: f:\Published_APP\GAUIUMS\GeneralNotification\General_Inst_Notification.aspx.cs    Line: 36

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) +12849870
   System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +133
   System.Convert.FromBase64String(String s) +43
   GeneralNotification_General_Inst_Notification.Decrypt(String cipherText) in f:\Published_APP\GAUIUMS\GeneralNotification\General_Inst_Notification.aspx.cs:36
   GeneralNotification_General_Inst_Notification.Page_Load(Object sender, EventArgs e) in f:\Published_APP\GAUIUMS\GeneralNotification\General_Inst_Notification.aspx.cs:25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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