How to get logged in user userrole in kentico9 through api??

gopi c asked on May 13, 2016 08:43

How to get currently logged in user userrole in kentico9 through api??

Correct Answer

Dawid Jachnik answered on May 13, 2016 11:46

Hello,

AuthenticationHelper.IsAuthenticated() method idicates that current user is logged in.

MembershipContext.AuthenticatedUser holds the current user

example:

if (CMS.Membership.AuthenticationHelper.IsAuthenticated())
    {
        if (CMS.Membership.MembershipContext.AuthenticatedUser.IsInRole("yourRoleName","siteName"))
        {
            //do something
        }
    }
3 votesVote for this answer Unmark Correct answer

Recent Answers


gopi c answered on May 13, 2016 15:06

Thankyou Dawid Jachnik

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.