I was wondering if it is possible to allow parts of the view inside the view.
For example, I understand how to enable the entire controller in this method
<HandleError()> _
Public Class HomeController
Inherits System.Web.Mvc.Controller
Function Index()
Return View()
End Function
<Authorize(Roles:="Administrators")> _
Function AdministratorSecrets()
Return View()
End Function
End Class
But what kind of ID you like to do is if the administrator logs in, they can see additional links in my navigation.
Something along the lines
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home")%></li>
<li><%= Html.ActionLink("About", "About", "Home")%></li>
<Authorize(Roles:="Administrators")> _
<li><%= Html.ActionLink("Admin", "Admin", "Home")%></li>
</ul>
Obviously this will not work, but it gives an idea of what I'm trying to accomplish.
Any ideas?
source
share