Hi, This is a follow on from: http://stackoverflow.com/questions/3605689/mvc-partial-login-control
I got the AccountController Logon Post event firing from my child control. The problem I have now is that when a user enters an incorrect password the AccountController Logon post tries to return to the Logon.aspx page not my Logon partial control. This is the code from the controller:
<HttpPost()> _
Public Function LogOn(ByVal model As LogOnModel, ByVal returnUrl As String) As ActionResult
If ModelState.IsValid Then
If MembershipService.ValidateUser(model.UserName, model.Password) Then
FormsService.SignIn(model.UserName, model.RememberMe)
If Not String.IsNullOrEmpty(returnUrl) Then
Return Redirect(returnUrl)
Else
Return RedirectToAction("Index", "Home")
End If
Else
ModelState.AddModelError("", "The user name or password provided is incorrect.")
End If
End If
' If we got this far, something failed, redisplay form
Return View(model)
End Function
Im passing the returnUrl in so if the user enters the correct details it works perfectly. But all i want it to do is if they enter the wrong details is to show "The User Name or Password provided is incorrect" on my child control.
Any ideas?
Thanks