IsInRole not working using MVC 4

IsInRole not working using MVC 4

Old forum URL:

CyclingFoodmanPA posted on Friday, March 01, 2013

I have an application written in Csla using Mvc 3 and converted it to Mvc 4.  I have a menu that displays items based on what role the user is in.  Hmm, the link used to be: for the site map.  This I combined with implementing membership and role provider at: and got a really cool treeview menu to work and the items displayed based on the role or roles the user was in and they were using Csla.  Here is the code that works in Mvc 3, but does not work in Mvc 4:

 public override bool IsAccessibleToUser(System.Web.HttpContext context, System.Web.SiteMapNode node) {
// If node has no roles specified means it is accessible (unless parent is not   accessible)
  if (node.Roles == null) {
return true;
  // Iterate roles
foreach (string role in node.Roles) {
// If user is in role, node is accessible
    if (Csla.ApplicationContext.User.IsInRole(role))
//if (context.User.IsInRole(role)) {
// Node is accessible
return true;
// Node is not accessible
return false;

The code is executing in LoadUser in my NWIdentity.cs code but somehow
base.Roles = new Csla.Core.MobileList<string>(data.Roles);
is not keeping the roles in the ApplicationContext.

Any ideas on how to upgrade to Mvc 4 would be most appreciated.



Copyright (c) Marimer LLC