You could put a validation summary in your layout somewhere. (Razor syntax):
<div>@Html.ValidationSummary(false)</div>
Then just decorate the viewmodel that is being passed to your login with [Required] attributes.
public class LoginViewModel
{
[Required(ErrorMessage="Please enter a your user name.")]
public string UserName { get; set; }
[Required(ErrorMessage = "Please your password.")]
public string Password{ get; set; }
}
or if you wanted to put a more general error message just leave your viewmodel properties decorated with the [Required] attribute, then in your Login controller, in the POST method do something like this:
[HttpPost]
public ActionResult Login(LoginViewModel viewModel)
{
if (!ModelState.IsValid)
{
ModelState.AddModelError("Error", "Sorry, your login failed, please try again.");
}
}
that error will then show up in the validation summary.