c# - HttpModule vs DelegatingHandler - advantages/disadvantages? -


i'm trying log entire incoming requests , outgoing responses in asp.net webapi project. while i'm agreed delegatinghandler, employer insists on using httpmodule. how explain her, why should use delegatinghandler , not httpmodule? or wrong?

i use delegatinghandler. delegatinghandler part of web api pipeline , can run under host. httpmodule not part of web api , requires iis.

though not directly related question, i'm going quote following msdn article highlights 2 including differences:

http module option web apis running on iis. http modules allow security code execute part of iis pipeline. principal established http module available components, including iis components running later in pipeline. example, when principal established http module in response authenticaterequest event, username of principal gets logged correctly in cs-username field in iis logs. biggest drawback http modules lack of granularity. http modules run requests coming application. web application different capabilities such html markup generation, web apis , on, having http module enforcing authentication in 1 way not flexible-enough approach. disadvantage using http module dependency on host—iis, in case.

message handler extensibility option provided asp.net web api, greatest benefit in using message handler security it’s concept of asp.net web api framework and, hence, doesn’t depend on underlying host or server. also, message handler runs web api requests. downside of using message handler lack of finer control. message handler can configured run global handler requests or specific route. given route, can have multiple controllers. these controllers , action methods contain must share same authentication enforced message handler configured route. in other words, lowest granularity authentication implemented message handler @ route level.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -