Hi,
I have written some coding for login check. But problem is that my message box is not display. if i try below coding then it is getting error.
So when i clik login button then check my condition with if and if condition is failed then display messgebox as like 'Login Failed' else go to next page. I want exactly messagebox not lable type message. as like javascript alert messagebox.
Code:
public ActionResult UserLogin()
{
return View();
}
[HttpPost]
public ActionResult UserLogin(string UserName, string Password)
{
using (ConnectionString userLogic = new ConnectionString())
{
var Result = userLogic.Database.ExecuteSqlCommand(
"SELECT_VISIONMUMBAI_USERNAME_CREDENTIAL @USERNAME, @PASSWORD",
new SqlParameter("@USERNAME", UserName),
new SqlParameter("@PASSWORD", Password));
if (Convert.ToInt32(Result) == -1)
{
ModelState.AddModelError("", "The user login or password provided is incorrect.");
RedirectToAction("UserLogin");
}
else
{
RedirectToAction("UserLogin", "User");
}
}
return View();
}