Scenario :
I have two controllers say Home Controller and Security Controller. My Home Controller View..Index is having Login Control {TextBoxex and Button}; Now My code in Index View of Home Controller is :
@using (Html.BeginForm("CheckLogin", "Security", FormMethod.Post))
And the code in Security Controller is :
/* Security Controller */
[HttpPost]
public ActionResult CheckLogin(LoginModel login)
{
if (ModelState.IsValid)
{
if ((login.UserName.ToUpper() == "ADMIN") && (login.Password.ToUpper() == "NIMDA"))
{
//Do further Redirection
}
else
{
//Here I want to return to Index View of Home Controller and get error displayed
what i have kept in ModelState.AddModelError(""); method
}
}
}
Now I want to display error message from Security controller to Index View of Home Controller with Error Message that Invalid Login or Validation Summary......
Loading


Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 24, 2014, 7:48 PM EST
Mayur Dhavle101 reputationPosted Feb 24, 2014, 8:19 PM EST
Thank you very much for replying to this thread. I would be happy if you could send me a practical example of this query.
Once again appreciating you for your reply.
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 24, 2014, 8:32 PM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 25, 2014, 1:01 AM EST