O.k. seems simple and maybe it's staring me in the face but I have spent time on my objects, nhibernate persistence with repositories and so on and I get to what I think is going to be the simple part creating the mvc project. Right now I have a login form in a basic Login view:-
Code:
Login
Your Login Details
Username:
Password:
The code in the controller:-
Code:
[AcceptVerbs(HttpVerbs.Get)]
public ViewResult Login()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ViewResult Login(string username, string password)
{
CmasUser u = _adminService.GetUserByUsername(username, password);
//if (u.LoginSuccessful)
//{
// return View("Users");
//}
TempData["LoginMsg"] = u.LoginStatus;
return View();
}
I can step through all of this and show that the code is being called but the problem is the username is what I have entered first time around and is forever after. i.e. I enter boconnell which does not exist and I correctly get a "Username not found!" message on the view. I then enter boconnell6 which I know to exist (because if I stop and start again with boconnell6 the username is found) and the controller action receives boconnell again and again and again. Basically the first value entered and posted will forever more be the value in that textbox.
I've been struggling to debug this. I stepped into the global.asax where the controller is created using Rhino Commons:-
Code:
public class RhinoIoCControllerFactory : IControllerFactory
{
public IController CreateController(RequestContext requestContext, string controllerName) {
return IoC.Resolve((controllerName + "Controller").ToUpper());
}
public void ReleaseController(IController controller) {
IoC.Container.Release(controller);
}
}
This runs every time a controller is requested and I can see by expanding the requestContext while debugging that the form collection contains "boconnell" so I am truly at a loss. I really hate when something so simple brings everything to a halt. Anyone out there got any ideas. Maybe it is something simple I have completely misssed.