I'm new to MVC. I want to be able to hide some actionlinks for some users. Say I have a "create" actionlink which I only want administrators to see and click. I want to use some sort of "loggedintemplate" available in asp.net, but it doesn't seem to work in razor.
I could use some sort of code block with an if statement checking the current user and her role, however that may not be best practice?
my index.cshtml..
// want some adminauth attribute here...
@Html.ActionLink("Create New", "Create")
my controller..
// GET: /Speaker/Create
[Authorize(Roles = "Administrators")]
public ActionResult Create()
{
return View();
}