public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProvaModel prov = db.Textos.Find(id); if (prov == null) { return(HttpNotFound()); } AesCryptoServiceProvider aes = new AesCryptoServiceProvider(); aes.BlockSize = 128; aes.KeySize = 256; aes.IV = Encoding.UTF8.GetBytes(AesIV256BD); aes.Key = Encoding.UTF8.GetBytes(AesKey256BD); aes.Mode = CipherMode.CBC; aes.Padding = PaddingMode.PKCS7; string msgE = prov.Texto; byte[] src = Convert.FromBase64String(prov.Texto); using (ICryptoTransform decrypt = aes.CreateDecryptor()) { byte[] dest = decrypt.TransformFinalBlock(src, 0, src.Length); prov.Texto = Encoding.Unicode.GetString(dest); } string msgD = prov.Texto; TempData["msgE"] = msgE; TempData["msgD"] = msgD; return(View()); }