0
@if (User.IsInRole("Admin")) {
//Link goes here.
}

That all works fine and dandy but what do I do when I would like to allow multiply roles such as:

@if (User.IsInRole("Admin, SuperUser")) {
//Link goes here.
}
Chantry
  • 3
  • 2

1 Answers1

3

You should use the conditional-OR operator (||). See Microsoft documentation here: https://msdn.microsoft.com/en-us/library/6373h346.aspx

@if (User.IsInRole("Admin") || User.IsInRole("SuperUser") {
//Link goes here.
}
MadDev
  • 1,130
  • 1
  • 13
  • 29