开发者

how to show hide&hide buttons for specific user in asp.net mvc2

开发者 https://www.devze.com 2023-02-01 05:57 出处:网络
how can I show button for specific user and hide it for another one based on security role in ASP.NET MVC 2.

how can I show button for specific user and hide it for another one based on security role in ASP.NET MVC 2.

For example if I 开发者_Python百科have Create button in my view how to show it only for admin and hide it for any other user.

Thanks.


<% if (User.IsInRole("admins"))
{ %>
    <input type="button" value="Create" />
<% } %>

Where "admins" is the name of your Role

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号