title: Invalid length for a Base-64 char array during decryption
body: <p>i use the below code during login i get the following error </p>
  
  <p>Invalid length for a Base-64 char array or string. </p>
  
  <p>Line 24:  byte[] cipherBytes = Convert.FromBase64String(txtpas.Text);</p>
  
  <pre><code> protected void txtlog_Click(object sender, EventArgs e)
      {
          string EncryptionKey = "MAKV2SPBNI99212";
          byte[] cipherBytes = Convert.FromBase64String(txtpas.Text);
          using (Aes encryptor = Aes.Create())
          {
              Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
              encryptor.Key = pdb.GetBytes(32);
              encryptor.IV = pdb.GetBytes(16);
              using (MemoryStream ms = new MemoryStream())
              {
                  using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write))
                  {
                      cs.Write(cipherBytes, 0, cipherBytes.Length);
                      cs.Close();
                  }
                  txtpas.Text = Encoding.Unicode.GetString(ms.ToArray());
  
                  if (u.Login(txtuser.Text, txtpas.Text) == true)
                  {
                      UtilityClass.CreateCookie("login", new string[] { "username", "usertypeid" }, new string[] { txtuser.Text, u.UserTypeID.ToString().Trim() }, !chkrem.Checked, Response);
                      Response.Redirect("SiteAdmin/index.aspx");
                  }
                  else
                  {
  
                      Label1.Text = "“Invalid Username or Password”";
  
                  }
              }
          }
          }
  </code></pre>