1

In short, I have created a custom membership provider and a custom member. This is using the "old" .NET membership provider system. Right now I can log in successfully, and the custom member is accepted by the system as well.

Note: Only methods implemented so far in the membership provider is "ValidateUser(name, pass)" and "GetUSer(username, isonline)"

The problem is, I cant get any info from the custom member. Nothing. Everything I have tried fails. I dont think it will even matter to list what I have tried, and Googling doesnt return anything that works. Its funny how I feel like the only person in the world who has a custom member, but obviously I cant be :/

I am using Umbraco 7.5.2 if it helps.

EDIT Ok here is one of the things I have tried:

Membership.GetUser()

Apparently that doesnt work in MVC4+ and I am using MVC 5. I also tried casting it to my custom member type of course, but it's always null.

Also for current Umbraco guides they all apply to the built in member service in Umbraco 7 which is totally different than the old way of doing it. I was under the impression that once a user was logged in, the information stored in the user/member object was readily available in the front end.

EDIT 2 I have the following solution but it is far from perfect. When getting the user that is currently logging in, before I return the custom membership user, I send the entire object to the session, and get information like this:

@if (Members.IsLoggedIn())
    {
        Site.Extensions.TripleAMembershipUser tmpUser = new Site.Extensions.TripleAMembershipUser();
        if (Session["currentUser"] != null)
        {
            tmpUser = (Site.Extensions.TripleAMembershipUser)Session["currentUser"];
            <div><h1>@tmpUser.someCustomString</h1></div>
        }
    }
Frederik T
  • 533
  • 2
  • 10
  • 30
  • But still, try listing what you've tried. At least it'll save the rest of us some time instead of suggesting things you've already tried ;-) – Jannik Anker Sep 15 '16 at 11:45
  • I have made a minor edit to my original post. I think this all boils down to: How do I get member/user information from a user that is logged in Umbraco, with MVC5 and using an old-fashioned membership provider? – Frederik T Sep 15 '16 at 12:14
  • Have you tried using `MembershipHelper`? Something like this: `var loggedInMember = Members.GetCurrentMember();`? – Marko Jovanov Sep 15 '16 at 12:30
  • I tried, but that is not supported by the asp.net membership provider. I have updated my original post with a possible solution. – Frederik T Sep 15 '16 at 12:34
  • 1
    Give me a couple of days, and I will dig into our project, and see how we did the implementation. We were using Umbraco 7.3.2 - considering that you are using a newer version, you should be able to have similiar, if not the same, implementation. – Marko Jovanov Sep 16 '16 at 07:32
  • That would be great! As mentioned in my edit, I have found a solution, although far from pretty, it is enough so I can proceed with development. But implementing a "correct" variant is above all preferred. – Frederik T Sep 16 '16 at 07:36

0 Answers0