Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i give username and password correct its going to next page but when i give invalid username and password i don't know how to get lable as invalid credentials. Please any one help me
Posted
Updated 17-Mar-14 8:57am
v2
Comments
chintu fron cali 17-Mar-14 15:19pm    
Please can anyone help me with this

1 solution

if (ModelState.IsValid)
{

if (model.UserName == "Admin" && model.Password == "1111")
{
FormsAuthentication.SetAuthCookie(model.UserName, false);
return RedirectToAction("About", "Home");
}
{
ModelState.AddModelError("", "Invalid Username or Password");
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900