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 48:         public String Decrypt(String encryptedText, String key)
Line 49:         {
Line 50:             var encryptedBytes = Convert.FromBase64String(encryptedText);
Line 51:             return Encoding.UTF8.GetString(Decrypt(encryptedBytes, GetRijndaelManaged(key)));
Line 52:         }

Source File: e:\inetpub\vhosts\mahacu.org\mahacucouncil.org\httpdocs\App_Code\AES256.cs    Line: 50

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
   WebApplication2.AES256.Decrypt(String encryptedText, String key) in e:\inetpub\vhosts\mahacu.org\mahacucouncil.org\httpdocs\App_Code\AES256.cs:50
   MessageforRegistrer.Page_Load(Object sender, EventArgs e) in e:\inetpub\vhosts\mahacu.org\mahacucouncil.org\httpdocs\MessageforRegister.aspx.cs:36
   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.4700.0