New Posts New Posts RSS Feed: Roles not populated on client.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Roles not populated on client.

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: Roles not populated on client.
    Posted: 24-Nov-2011 at 6:10am
On the client, I am trying to determine if a user is in a particular role.

In web.config, <roleManager enabled="true" />.

The ASPNet.db has a role created and a user is assigned the role.

If I open up ASPNet Configuration in Visual Studio, it shows the user, the role, and the user being in the role. So it is set up correctly.

I then log in as that user.

In the LoggedIn event, I check to see if the user is in a role:

bool isInRole = AuthenticationManager.Current.User.IsInRole("EmailAdmin");

However, this always returns false. In looking at User.Roles, it is always empty. However, it does show the correct user.

Any idea what's up?

Greg

Edited by gregweb - 24-Nov-2011 at 6:15am
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 29-Nov-2011 at 6:32pm
Hi Greg;

Are you using the UserBase class (DevForce's Default IPrincipal implementation)? This class will serialize the roles back to the client.

If you have a custom IPrincipal implementation instead, you need to make sure that the roles are serialized as part of the data contract.
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 30-Nov-2011 at 5:06am
OK thanks, this is working now.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down