I'm planning on making a partial view for logging in and I'm wondering how I can trigger the multiplexing provider to do its thing?
Take a look at the MVC sample code for Alloy. Your post action method would typically look like this:
public ActionResult LogOn(LoginViewModel model, LoginPage currentPage)
if (Membership.Provider.ValidateUser(model.UserName, model.Password))
ModelState.AddModelError("", "The user name or password provided is incorrect.");
model.Heading = currentPage.PageName;
model.MainBody = currentPage.MainBody;
model.SecondaryBody = currentPage.SecondaryBody;
return View("Index", model);
I have a PageControllerBase class which all controllers inherit from.
I've added a ActionResult Login(LoginModel model) method to it but I can't seem to send a request to it.
What url should the form post to? I've tried action="/login" and action="/standardpage/login" without success.
If you use the Html.BeginForm helper for your login form, then you can just pass null as a controller name and forms action attribute will be rendered with the current controller:
Html.BeginForm("Login", null, FormMethod.Post)
Thanks Sergii, I've already tried that. It just returns a Http Error 404 page. =/
I have that problem now, did you find a solution?
Dennis, I haven't got around to working with it some more, been busy with other work but I'll let you know when I do.