Created
April 14, 2020 07:43
-
-
Save CoreProgramm/8db3251051b9e43aac490a07481f5571 to your computer and use it in GitHub Desktop.
Encrypt in JavaScript and Decrypt in C# With AES Algorithm in ASP.Net MVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[ValidateAntiForgeryToken] | |
public ActionResult Index(Login objUL) | |
{ | |
if (ModelState.IsValid) | |
{ | |
var username = AESEncryption.DecryptStringAES(objUL.Username); | |
var password = AESEncryption.DecryptStringAES(objUL.Password); | |
if (username == "keyError" && password == "keyError") | |
{ | |
TempData["notice"] = "Invalid Login"; | |
} | |
else | |
{ | |
TempData["notice"] = "login successfully"; | |
} | |
return View(objUL); | |
} | |
else | |
{ | |
ModelState.AddModelError(string.Empty, "Invalid Login"); | |
return View(objUL); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment