我试图从我的应用程序中返回适当的Http代码和响应,但我正在努力。似乎有两种方法可以返回特定的http响应。public Information Get(int apiKey) if (!_users.Authenticate(apiKey)) var response = new HttpResponseMessage(); response.ReasonPhras
我编写了一个ActionFilter,它检查传递给任何给定Web操作方法的指定字符串参数的长度,如果长度不正确,则将ActionContext.Response设置为HttpStatusCode.BadRequest>的IActionFilter<,如上面博客文章中的示例所示。以下是我的ActionFilter /“行为”代码的关键所在。new SimpleInjectorWebApiDependencyResolver(container);
// the rest o
我们使用ASP.NetWebAPI来生成提要,它包含了分页的功能。我的老板说:“让我们也允许用户使用‘分页’,因为这就是WP所使用的。”pageIndex=2 public Foo Get(int page = 1) //do some stuff所以我尝试创建一个ActionFilter
public o