ASP.NET Menu Control (Security Trimming)

Here I am using the ASP.NET Menu control with Security Trimming enabled to show/hide nodes to users to certain roles.

There are 2 roles: administrator and projectdirectors.

The problem is that for the "Print Checks" node, it is appearing for users in the projectdirectors role when clearly it is assigned the administrator role.

It is weird because it works for the Reports node and will hide the "By Date" node to projectdirectors.

I don't know if this is relevant but the /Checks/ and /Reports/ urls are using ASP.NET routing.

I am using C# with .NET 3.5 SP1.

Any ideas?

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="">
  <siteMapNode url="~/Default.aspx" title="Home">
    <siteMapNode title="Reports" roles="*">
      <siteMapNode url="~/Reports/View/ByDate" title="By Date" roles="administrator" />
      <siteMapNode url="~/Reports/View/ByStudy" title="By Study" roles="projectdirectors" />
    <siteMapNode title="Checks" roles="*">
      <siteMapNode url="~/Checks/View" title="View Checks" roles="*" />
      <siteMapNode url="~/Checks/Print" title="Print Checks" roles="administrator" />
      <siteMapNode url="~/InvalidChecks.aspx" title="Invalid Checks" roles="administrator" />
    <siteMapNode title="User" roles="*">
      <siteMapNode url="~/User/Profile.aspx" title="Profile" />
      <siteMapNode url="~/User/ChangePassword.aspx" title="Change Password" />
    <siteMapNode title="Admin" roles="administrator">
      <siteMapNode url="~/Admin/AddUser.aspx" title="Add User" roles="administrator" />
      <siteMapNode url="~/Admin/ViewUsers.aspx" title="View Users" roles="administrator" />

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RyanAndresAuthor Commented:
This is how the Menu control is placed in my .master page.
        <asp:LoginView ID="NavigationLoginView" runat="server">
                <div id="nav" style="background-color: #DDDDDD; width: 100%; float: left;">
                    <div style="float: left; display: block;">
                        <asp:Menu ID="MenuMain" runat="server" BackColor="#DDDDDD" DataSourceID="SiteMapDataSource1"
                            DynamicHorizontalOffset="2" StaticSubMenuIndent="10px" DynamicEnableDefaultPopOutImage="False"
                            StaticDisplayLevels="2" StaticEnableDefaultPopOutImage="False" Orientation="Horizontal">
                            <StaticSelectedStyle BackColor="#DDDDDD" />
                            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                            <DynamicHoverStyle BackColor="#DDDDDD" ForeColor="White" />
                            <DynamicMenuStyle BackColor="#DDDDDD" />
                            <DynamicSelectedStyle BackColor="#DDDDDD" />
                            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                            <StaticHoverStyle BackColor="#DDDDDD" ForeColor="White" />
                    <div style="float: right; display: block; background-color: #DDDDDD; padding-top: 2px; padding-bottom: 2px;
                        padding-left: 5px;">
                        Logged in as:
                        <asp:LoginName ID="LoginName" runat="server" />
                        <asp:LoginStatus ID="LoginStatus" runat="server" OnLoggedOut="LoginStatus1_LoggedOut"
                            LogoutAction="RedirectToLoginPage" />
                        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

Open in new window

RyanAndresAuthor Commented:
I figured it out. You must set authorizations in web.config rather than the roles attributes in .sitemap


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.