Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Add Current User to Role

$
0
0

I want to add the currently logged in user into a role if they don't belong to it. 

How do I get their username?

    if(!User.IsInRole("Member"))
        {
            Roles.AddUserToRole(CurrentlyLoggedInUser, "Member");
            Membership.UpdateUser(CurrentlyLoggedInUser);
        }

Thanks for your help.


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>