I am using ASP.NET MVC4. I have different types of users, (let's say Type1 and Type2), which will have different menus. Therefore, I entered at the master site, something like the following
<% if (Page.User.IsInRole("TypeA")){%>
<li><%: Html.ActionLink("Test1", "Test1", "Test")%></li>
<li><%: Html.ActionLink("Test2", "Test2", "Test")%></li>
<%}
else{%>
<li><%: Html.ActionLink("Test3", "Test3", "Test")%></li>
<li><%: Html.ActionLink("Test4", "Test4", "Test")%></li>
<%
}
I do not know if that is the best way to do it, but this was what I thought (If there is any better or professional way to do this, please suggest it to me).
The problem now, is that If userA is logged in, then how I can highlight the page Test1 if he is at Test1,and how do I highlight the page Test2 if he is at Test2 at the menu?
I mean, if I had the menu code at each page, this is easy. But how I can do that when the menu is at the Site Master?
I cannot come up with any practical, or nice solution on that...
Is there a way to do that?