Let's say I have a controller action that is limited only to specific users, for example:
[Authorize(Roles="somerole")]<br />
public ActionResult TestRestricted() {
return View();
}
In a view that is publicly available to everyone, I have a link to the action above:
<%= Html.ActionLink("Click here!", "TestRestricted") %>
I would like to hide the link for everyone who is not allowed to perform the "TestRestricted" -action. Is there a way to check if the current user is allowed to use the appropriate action? Without defining any additional or duplicate access rules in addition to the authorization filter?
Mika lehtinen
source
share