1

I need to hide a link if a user is not logged in, and show the link if the user is logged in. I should use HTML. But the following:

 @if(Authorize(Roles = "admin")) <li>@Html.ActionLink(@Resources.LayoutLang.myarticles, "MyReviews", "Review")</li>

does not work. How to check the role in HTML?

lenz
  • 5,658
  • 5
  • 24
  • 44
Vasiliy Terkin
  • 165
  • 2
  • 15
  • Take a look at this answer it should help: http://stackoverflow.com/questions/6981853/asp-net-mvc3-razor-display-actionlink-based-on-user-role/6981928#6981928 – Richard Aug 23 '15 at 11:45
  • Error - Role Manager feature is not included. But this.UserManager.AddToRoleAsync(user.Id, "Reviewer"); in controller is work – Vasiliy Terkin Aug 23 '15 at 11:55
  • What is `Authorizer`? Is this some kind of authorization service? – kamil-mrzyglod Aug 23 '15 at 12:16
  • I don't remember where find this))) – Vasiliy Terkin Aug 24 '15 at 14:55
  • "Role manager featured is not included" i fix added string in web.config. I have new problem - if user logged in, page is not load. – Vasiliy Terkin Aug 24 '15 at 15:04