Mon*_*key 7 asp.net-mvc asp.net-web-api
使用MessageHandler和Filter来检查MVC web api项目的请求标头中的API密钥有什么区别.
我看到在http://www.asp.net/web-api/overview/working-with-http/http-message-handlers中有一个用于此目的的MessageHandler的概述示例
例如
GlobalConfiguration.Configuration.MessageHandlers.Add(new ApiKeyHandler());
Run Code Online (Sandbox Code Playgroud)
但看起来我也可以使用过滤器做同样的事情.
GlobalConfiguration.Configuration.Filters.Add(new ApiKeyFilter());
Run Code Online (Sandbox Code Playgroud)
假设ApiKeyFilter和ApiKeyHandler都只是查看请求标头并检查api密钥,哪种方式更有效?有什么不同?
| 归档时间: |
|
| 查看次数: |
2191 次 |
| 最近记录: |