Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何根据 ASP.NET MVC 2 中的安全角色为特定用户显示按钮并为另一个用户隐藏它。
例如,如果我的视图中有“创建”按钮,如何仅为管理员显示它并为任何其他用户隐藏它。
谢谢。
<% if (User.IsInRole("admins")) { %> <input type="button" value="Create" /> <% } %>
"admins"你的角色名称在哪里
"admins"