Copied to clipboard

Flag this post as spam?

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


  • Kamil 7 posts 68 karma points
    Jan 15, 2014 @ 17:36
    Kamil
    0

    Using logged member details in custom .NET controller

    Hello all,

    Im new to this forum, Umbraco and ASP.NET in general, although I have been programming in C# before.

    I have set up the Membership Provider model available in Umbraco, I have created members, member groups and assigned public access to some pages for certain member groups.

    I have also created a custom .NET controller in C#. Some functions of the Controller should be available for certain member groups, while others can be visible to everybody.

    How can I access and check ale the details of currently logged user, like member group, name or id, to use them within the controller to show/hide elements?

    Thank you in advance!

  • Marcio Goularte 388 posts 1360 karma points
    Jan 15, 2014 @ 18:18
    Marcio Goularte
    100

    Hi Kamil,

    Welcome to the forum.

    Try this:

     var member = System.Web.Security.Membership.GetUser();

    Reference: http://our.umbraco.org/wiki/how-tos/membership-providers

  • Kamil 7 posts 68 karma points
    Jan 15, 2014 @ 18:28
    Kamil
    0

    Thank you Marcio!

    Now it works, thanks for reference... now I see my question was quite silly as I could search better.

     

  • Marcio Goularte 388 posts 1360 karma points
    Jan 15, 2014 @ 19:15
    Marcio Goularte
    0

    the forum is to it, no matter the question ;)

Please Sign in or register to post replies

Write your reply to:

Draft