MVC - How to call the multiplexing provider?

Vote:
 

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?

#76864
Nov 05, 2013 10:32
Vote:
 

Take a look at the MVC sample code for Alloy. Your post action method would typically look like this:

[HttpPost]
        public ActionResult LogOn(LoginViewModel model, LoginPage currentPage)
        {
            if (ModelState.IsValid)
            {
                if (Membership.Provider.ValidateUser(model.UserName, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                    return RedirectToAction("Index");
                }
                else
                {
                    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);
        }

    

 

#76868
Nov 05, 2013 11:11
Vote:
 
#76905
Edited, Nov 06, 2013 8:04
Vote:
 

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.

#76908
Nov 06, 2013 8:58
Vote:
 

Hello Johan,

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)

    

#76917
Nov 06, 2013 12:08
Vote:
 

Thanks Sergii, I've already tried that. It just returns a Http Error 404 page. =/

#77002
Nov 06, 2013 13:37
Vote:
 

I have that problem now, did you find a solution?

#77211
Nov 13, 2013 8:36
Vote:
 

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.

#77231
Nov 13, 2013 12:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.