如何限制访问在ASP.NET MVC中的某些页面? [英] How do I restrict access to certain pages in ASP.NET MVC?

查看:135
本文介绍了如何限制访问在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆