Asp.Net MVC 1.0 Action Filters Tips

來源:互聯網
上載者:User

1.Action Filters Interface

  • IAuthorizationFilter
  • IActionFilter
  • IResultFilter
  • IExceptionFilter

2.Action Filters Interface Execute Order

(1).IAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext)

(2).IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)

(3).Action Content

(4).IActionFilter.OnActionExecuted(ActionExecutingContext filterContext)

(5).IResultFilter.OnResultExecuting(ResultExecutedContext filterContext)

(6).IResultFilter.OnResultExecuted(ResultExecutedContext filterContext)

(7).IExceptionFilter.OnResultExecuted(ExceptionContext filterContext)

3.Implement a particular type of filter

(1)If you want to implement a particular type of filter, then you need to create a class that inherits from System.Web.Mvc.FilterAttribute class and implements one or more of the IAuthorizationFilter, IActionFilter, IResultFilter, or ExceptionFilter interfaces.

(2)Just inherits from ActionFilterAttribute and overwirte the methods.(By default,The ActionFilterAttribute class implements IActionFilter and IResultFilter interface).

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.