可能有多个过滤器属性吗?
-
13-10-2019 - |
题
是否可以堆叠多个过滤器属性?例如,我有此属性,该属性检查一个人是否有权“管理员”或“队列”
[ClientPortalSecured("Administrator", "Queue")]
public ActionResult Index()
{
return View(this.GetModel());
}
但是,如果我想检查这些和其他东西怎么办?可以做这样的事情吗?
[ClientPortalSecured("Administrator", "Queue")]
[ClientPortalSecured("abc")]
public ActionResult Index()
{
return View(this.GetModel());
}
当我尝试此操作时,我目前会收到“重复的'Client PortalScured'属性'属性“属性”编译器错误。
解决方案
找到了。添加
[AttributeUsageAttribute(AttributeTargets.All, AllowMultiple = true)]
到我的客户端PortalsSuredAttribute类
不隶属于 StackOverflow