This project is read-only.

MVC 5 | Problem with default AccountController (2 constructors)

Sep 11, 2013 at 9:07 PM
Image
[Authorize]
    public class AccountController : Controller
    {
        public AccountController() 
        {
            IdentityManager = new AuthenticationIdentityManager(new IdentityStore());
        }

        public AccountController(AuthenticationIdentityManager manager)
        {
            IdentityManager = manager;
        }

        public AuthenticationIdentityManager IdentityManager { get; private set; }

        private Microsoft.Owin.Security.IAuthenticationManager AuthenticationManager {
            get {
                return HttpContext.GetOwinContext().Authentication;
            }
        }

        //
        // GET: /Account/Login
        [AllowAnonymous]
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            return View();
        }
Need advice how to solve this problem...?
Coordinator
Sep 11, 2013 at 9:53 PM
Well, that's simple, just get rid of the default constructor. There hardly ever is a need to have multiple constructors.
Marked as answer by dot_NET_Junkie on 3/2/2014 at 10:54 AM
Coordinator
Sep 2, 2014 at 7:15 AM
Edited Sep 2, 2014 at 7:15 AM
Please see this thread for a more elaborate discussion and solution for working with OWIN.