前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ASP.NET MVC Action Filters

ASP.NET MVC Action Filters

作者头像
张善友
发布2018-01-22 11:02:22
8240
发布2018-01-22 11:02:22
举报
文章被收录于专栏:张善友的专栏张善友的专栏

在看这篇Fun with Http Headers in ASP.NET MVC Action Filters的时候,提到了 Roni Schuetz在codeplex上创建的一个项目ASP.NET MVC Action Filters。计划在5月10日推出第一个版本。 项目计划包含的Action Filter:

  • Action filter for creating easy REST API with JSON and XML
  • Action filter for logging scenarios
  • Action filter for microsoft health monitoring
  • Action filter for client caching
  • Action filter for client compression
  • Action filter for server caching
  • Action filter for controller execution time measurement

简要介绍一下Action Filter:Action Filter作为一个可以应用到Controller Action(或者是整个controller)上的属性(Attribute),改变Action执行的行为。ASP.NET MVC Framework包括几种Action Filter:

  • OutputCache – 在指定的时间内缓存Controller Action的输出。
  • HandleError – 处理Controller Action发生错误的情况。
  • Authorize – 通过制定的用户或者角色约束访问权限。

你同时可以创建自己的Action Filter,比如说要实现一个自定义的验证系统,那么可能需要创建一个自定义的Action Filter,或者说当你需要改变Controller Action返回的View data的时候,也可以通过创建自定义Action Filter实现。

关于Action Filter的具体内容可参考 理解ASP.NET MVC Framework Action Filters(翻的)

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2009-04-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档