Copied to clipboard

Flag this post as spam?

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


  • AmandaEly 123 posts 379 karma points
    Dec 07, 2015 @ 17:03
    AmandaEly
    0

    Nullref when using GetCurrentMemberProfileModel version 7.2.8

    Hi,

    I know that this is a known bug (U4-5928) but I want to a) Check that I am running into the same bug that is fixed by https://github.com/umbraco/Umbraco-CMS/commit/7316c5462a34bbeea50769b4149725e2c1fbd1b0 and b) Get someone to tell me how to access this fix.

    My code is:

    @using Umbraco.Web.Security;

    @if (User.Identity.IsAuthenticated)
    {
        var membershipHelper = new MembershipHelper(UmbracoContext.Current);
        var member = membershipHelper.GetCurrentMemberProfileModel();
        }
    

    and so on ...

    This is currently giving a nullref on @member.Name, as member is null. I was previously logged in.
    Is this even the correct way to set up a login widget? (I think it is, actually). How do I handle when I get a null? I tried just logging the member out if that happens but that isn't enough as User.IsAuthenticated is still true.

    Help would be appreciated, as this is preventing me working at all.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft