Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 04, 2015 @ 21:33
    Simon Dingley
    0

    v6 Log Back office User in via Custom Login Form

    I have a requirement in a project for a back office user to login via a custom login page in order to access a custom area of the site which exists outside of the Umbraco back office. I'm struggling to get it working and it doesn't create a good experience for the user to use the Umbraco login page then have to put in the url they were heading for afterwards.

    I've tried a number of ways and looked at the Umbraco source and a lot of what I need seems to be tied up inside of internal methods which I can't use. The following unfortunately only works for me after logging in via the normal login page first:

      var provider = Membership.Providers["UsersMembershipProvider"];
      if (provider.ValidateUser(data.Username, data.Password))
      {
        FormsAuthentication.SetAuthCookie(data.Username, false);
        return RedirectToAction("Create", "RegistrationManager");
      }
    

    I've been doing some digging and have so far not found a way to specify what membership provider is used in conjunction with the FormsAuthentication.SetAuthCookie method.

    Am I overcomplicating this and missing an obvious solution? I think possibly not as looking at the Umbraco source the back office login does not appear to be straight forward either.

    Any help or advice appreciated?

    Thanks, Simon

Please Sign in or register to post replies

Write your reply to:

Draft