小编Adr*_*zki的帖子

将AuthorizeAttribute应用于控制器类并同时执行操作

是否有一种方法可以在具有Authorize属性的控制器类中的一个操作中忽略[Authorize]属性?

        [Authorize]
        public class MyController : Controller
        {
           [Authorize(Users="?")]//I tried to do that and with "*", but unsuccessfuly,
           public ActionResult PublicMethod()
           {
           //some code
           }

           public ActionResult PrivateMethod()
           {
           //some code
           }
        }
Run Code Online (Sandbox Code Playgroud)

只需要PrivateMethod()就可以进行身份​​验证,但也需要它.

PS:我不想制作我的自定义授权过滤器.

[]的

authentication authorization asp.net-mvc-3

9
推荐指数
2
解决办法
1万
查看次数