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

Conditional Role based menu display

$
0
0

I have form where I am displaying menu based on the AD group the person belongs to

<div class="navbar-collapse collapse" style="background-color:#04397d; "><ul class="nav navbar-nav" style="font-weight:bold;font-size:1.3em;color:white;" id="smenu" ><li><asp:Image ID="Logo" runat="server" ImageUrl="~/images/LogoText.png" style="padding-right:140px;padding-top:4.2%;" /></li><li><a runat="server" href="~/default.aspx"   >Home</a></li><% if (Roles.IsUserInRole("DMN\\WW_UPL"))
                               { %><li><a runat="server" href="~/secure/Upload/Upload.aspx" >Upload</a></li><%} %><% if (Roles.IsUserInRole("DMN\\WW_ADM"))
                               { %><li><a runat="server" href="~/secure/Upload/Upload.aspx" >Upload</a></li><li><a runat="server" href="~/secure/Admin/Add.aspx" >Administration</a></li><%} %><% if (Roles.IsUserInRole("DMN\\WW_AAM"))
                               { %><li><a runat="server" href="~/secure/Admin/Add.aspx" >Administration</a></li><%} %></ul>

when a user belongs to more than one AD group, the menu items are being repeated.

Is there anyway to use else if statement in the condition?


Viewing all articles
Browse latest Browse all 4737

Trending Articles



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