Copied to clipboard

Flag this post as spam?

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


  • Lars Ljungqvist 14 posts 34 karma points
    Mar 26, 2013 @ 12:45
    Lars Ljungqvist
    0

    Getting members name property

    Hi Everybody

    I am trying to access the properties of some members.

    I have both my own properties in the members and of course the Umbraco standard member properties.

    With the C# code below I can access my own properties of the members.This works:

    string propertyValue1 = member.getProperty("MyOwnProperty").Value.ToString();

    But how can I access the Umbraco standard properties. I want to access the node "Name". This code below does not find any property. How can I access the Name property or better: Find the alias'es of the Umbraco member standard properties since this might just be an alias problem.

    string propertyValueName = member.getProperty("Name").Value.ToString();

    Any help will be highly appreciated.

    Regards,

    Lars

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 26, 2013 @ 14:34
    Fuji Kusaka
    0

    Hi Lars,

    Try doing something like

    @using umbraco.cms.businesslogic.member
    @using System.Web 
    @using System.Web.Security

    @{
         var currentUser = Member.GetCurrentMember();       
                  var userName = currentUser.Text; 
                 @userName 
     
      }
     
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 26, 2013 @ 15:37
  • Charles Afford 1163 posts 1709 karma points
    Mar 27, 2013 @ 23:12
    Charles Afford
    0

    Hi, what version of Umbraco are you using?  The umbraco membership model has changed to the asp.net one :) 

    Membership.GetUser().UserName is what you need. 

  • Charles Afford 1163 posts 1709 karma points
    Mar 27, 2013 @ 23:21
    Charles Afford
    0
Please Sign in or register to post replies

Write your reply to:

Draft