AuthorizeAttribute 類別

定義

指定僅限符合授權需求的使用者才能存取控制器或動作方法。

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]
public class AuthorizeAttribute : System.Web.Mvc.FilterAttribute, System.Web.Mvc.IAuthorizationFilter
type AuthorizeAttribute = class
    inherit FilterAttribute
    interface IAuthorizationFilter
Public Class AuthorizeAttribute
Inherits FilterAttribute
Implements IAuthorizationFilter
繼承
AuthorizeAttribute
屬性
實作

建構函式

AuthorizeAttribute()

初始化 AuthorizeAttribute 類別的新執行個體。

屬性

AllowMultiple

取得或設定值,這個值表示是否可以指定多個篩選條件屬性執行個體。

(繼承來源 FilterAttribute)
Order

取得或設定動作篩選條件的執行順序。

(繼承來源 FilterAttribute)
Roles

取得或設定已獲授權可以存取控制器或動作方法的使用者角色。

TypeId

取得此屬性的唯一識別項。

Users

取得或設定已獲授權可以存取控制器或動作方法的使用者。

方法

AuthorizeCore(HttpContextBase)

覆寫時,提供自訂授權檢查的進入點。

HandleUnauthorizedRequest(AuthorizationContext)

處理授權失敗的 HTTP 要求。

OnAuthorization(AuthorizationContext)

在處理序要求授權時呼叫。

OnCacheAuthorization(HttpContextBase)

在快取模組要求授權時呼叫。

適用於