Copied to clipboard

Flag this post as spam?

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


  • Petr Hruzek 28 posts 100 karma points
    Jan 25, 2015 @ 18:43
    Petr Hruzek
    0

    Members.GetCurrentMember() always null

    I must be missing something obvious. In my surface controller I log in member by using this.Members.Login(model.Username, model.Password) and it correctly returns true. But subsequent call to this.Members.GetCurrentMember() is always equal to null.

    if (this.Members.Login(model.Username, model.Password))
    {
        return Content((this.Members.GetCurrentMember() == null).ToString()); // Always true
    }
    

    I am using Umbraco 6.2.4. What am I missing here???

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 26, 2015 @ 13:10
    Alex Skrypnyk
    0

    Hi Petr,

    Try this:

    if (umbraco.library.IsLoggedOn())
    {
      m = Membership.GetUser();
    }
    

    Thanks

  • Petr Hruzek 28 posts 100 karma points
    Jan 26, 2015 @ 14:12
    Petr Hruzek
    0

    Hello Alex!

    Thank you for the reply, but unfortunatelly umbraco.library.IsLoggedOn() is false. I really don't get it. If this.Members.Login(model.Username, model.Password) returns true, there should be logged in member, or am I wrong?

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 26, 2015 @ 14:14
    Alex Skrypnyk
    0

    what Request.IsAuthenticaed shows ?

  • Petr Hruzek 28 posts 100 karma points
    Jan 26, 2015 @ 14:19
    Petr Hruzek
    0

    It's false, Alex.

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 26, 2015 @ 14:25
    Alex Skrypnyk
    0

    so your authentication mechanism doesn't work at all

    Try to set authentication cookies manually.

    http://stackoverflow.com/questions/7217105/asp-net-how-can-i-manually-create-a-authentication-cookie-instead-of-the-defau

  • Petr Hruzek 28 posts 100 karma points
    Jan 26, 2015 @ 17:57
    Petr Hruzek
    100

    Well, it finally works. But to be honest, I don't know what fixed it, maybe recreating of members, maybe something else.

    Anyways, thank you Alex for your help.

Please Sign in or register to post replies

Write your reply to:

Draft