Server Error in '/atn' 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 31:         string EncryptionKey = "6LeyWeYUAAAAAF2JjhGmIm3Bk2e_qUWAndsVO-tg";
Line 32:         cipherText = cipherText.Replace(" ", "+");
Line 33:         byte[] cipherBytes = Convert.FromBase64String(cipherText);
Line 34:         using (Aes encryptor = Aes.Create())
Line 35:         {

Source File: d:\inetpub\vhosts\textures4photoshop.com\httpdocs\atn\App_Code\EncryptionHelper.cs    Line: 33

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
   EncryptionHelper.Decrypt(String cipherText) in d:\inetpub\vhosts\textures4photoshop.com\httpdocs\atn\App_Code\EncryptionHelper.cs:33
   direct_download.ProcessRequest(HttpContext context) in d:\inetpub\vhosts\textures4photoshop.com\httpdocs\atn\direct-download.ashx:17
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73


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