Me: Hey, I’d like to automatically invoke all my authentication / logging code for my API calls.
.NET: Totally got just the thing for you. Use IDisptachMethodInspector, look for the right events and call your Auth code. Also, use Aspect Oriented Programming. Since AOP is a giant pain in the ass to configure though, use this plugin that you can buy for $500 to automate it.
Rails: Use before_filter, around_filter.