1

Topic: WebAPI : authentication filters or not?

There can be someone analyzed, measured examples and so forth the Question to such people. It is known that authentification and authorization can be pulled out in filters and to cling to controlers through attributes. For example here. Whether I try to find the information probably here to benefit in productivity, refused filters? Yes, the code will be ugly if to pull out it in actions. But speech about productivity. What thoughts?

2

Re: WebAPI : authentication filters or not?

Hello, another_coder, you wrote: _> What thoughts? On comparing by a g-code which normally write on.net  in productivity . Generally any. Filters  so: the method in the controler is a reflection, is checked what is at it is . If there is "a prefix filter", a reflection  a method from a class of this filter, after  a method from the controler. So a choice: or to write  and net  causes this method of the filter or to alter  in a normal class and hands to cause a method of it  in the beginning of a body of a method of the controler.

3

Re: WebAPI : authentication filters or not?

Hello, another_coder, you wrote: _> What thoughts? I do not know as in the last version MVC - for a long time did not look, but in early versions calls of filters have been written extremely not optimally - the attribute was caused on two times, once at check and the second is immediate at performance, well and as a whole the code dirty enough. So it was better to write authentification and error handling not on attributes, and it is immediate on events of a stack of handling of request, as a result it turns out more purely and more correctly.