开发者

How to enable multiple roles for a MVCsitemapNode-ASP.NET

I am using MVCsiteMapNode to display the menu for various roles.

For single role Iam using the following.

<mvcSiteMapNode title="NewMenuItem" controller="TestMenu" 
                action="Index" Roles="SystemAdmin"/>

For Multiple Roles, I want to display the same menu. It tried this:

<mvcSiteMapNode title="NewMenuItem" controller="TestMenu" 
                action="Index" Roles="SystemAdmin开发者_开发问答,NewRole"/>

It does not display if the current user is a member of the SystemAdmin role.

In my helper class I am using the following

if (isSystemAdmin)
{
    if (node["roles"].Equals("SystemAdmin"))
    {
        DisplayMenu(sb, node);
    }
}

Can anybody help? Thank you.


Try something like:

if (node["roles"].Contains("SystemAdmin")) ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜