Hi,
I have a login box in my MasterPage. Whenever the login information is not correct, I valorize ViewData["loginError"]
to show the error message to the user.
Login is an action of the UserController, so the form that contains the login has action = "/User/Login"
.
As a user can try to log in from any page, in case of success I redirect him to his personal page, but in case of error I want him to stay on the very same page where he tried to login. I've found that this works:
return Redirect(Request.UrlReferrer.ToString());
but it seems that, as I'm not returning a proper view, the data on ViewData is lost, so I cannot show the error message.
Any suggestion on how to solve this and similar problems?
Thanks