Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC ActionFilter like attributes for WCF

Is there a way I can create custom method attributes for WCF that allow me to easily decorate a service method with a pre filter much like MVC uses action filters. I plan to use them for authentication and authorization. This is for a RESTful service whose requests are carrying an authentication cookie.

I am more interested in how to create the attributes rather than the authentication side of things. Does the HTTP Toolkit offer anything?

Thanks

like image 520
Slappy Avatar asked Jul 25 '11 05:07

Slappy


People also ask

What is the use of Actionfilters in MVC?

ASP.NET MVC provides Action Filters for executing filtering logic either before or after an action method is called. Action Filters are custom attributes that provide declarative means to add pre-action and post-action behavior to the controller's action methods.


1 Answers

WCF has great extensibility - in many ways. You can encapsulate lots of functionality into e.g. service and/or operation behaviors, which can be attached to a service or operation by means of an attribute.

Check out the current DotNet Rocks TV Show #202 with Miguel Castro on WCF extensibility - it should give you an idea of what is possible (and lots more is possible, for sure!)

See also:

  • WCF Extensibility Samples
  • WCF Extensibility Deep Dive
  • WCF Extensibility Screencast
like image 189
marc_s Avatar answered Oct 25 '22 08:10

marc_s