TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mayur Dhavle
NA
119
24k
MVC Exception Handling
Feb 24 2014 11:51 PM
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......
Reply
Answers (
4
)
Design Pattern for Task Notification System
Fileuplaod in asp.net