如何限制访问在ASP.NET MVC中的某些页面? [英] How do I restrict access to certain pages in ASP.NET MVC?
问题描述
我要锁定是否
一)Identity.IsAuthenticated = FALSE
a) Identity.IsAuthenticated = false
或者认证但
B)Idenitity.Name!=他们正试图编辑
C)Identity.UserType()!= UserType.Administrator //这就像一个角色,而无需使用RoleProviders。
b) Idenitity.Name != user name of the user page they are trying to edit
c) Identity.UserType() != UserType.Administrator // This is like a Role, without using RoleProviders.
我假设U可以装饰一个控制器或控制的东西(S)的操作方法,但我只是不知道是什么?
I'm assuming u can decorate a controller or a controller's action method with something(s), but i'm just not sure what?
推荐答案
看 AuthorizeAttribute
。
<一个href=\"http://stackoverflow.com/questions/532773/asp-net-mvc-can-the-authorizeattribute-be-overriden\">http://stackoverflow.com/questions/532773/asp-net-mvc-can-the-authorizeattribute-be-overriden
这篇关于如何限制访问在ASP.NET MVC中的某些页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!