I have an ISAPI Application in Delphi 6 that uses WebBroker. I need to add logging information at the beggining and the end of each Action.
I have tried OnBeforeDispatch and OnAfterDispatch, but some actions sent the response directly to the browser and the OnAfterDispatch event is never fired.
Is there a way to add a filter or something without having to add code to each action?
One way you can do that is to have only one action. Set the path to “/” and action as default handler. Then:
I always do an action handler engine that has all actions registered. Then the code is like this
Now just add logging 🙂 This has other benefits. Every handler is then in its own unit and you achieve the MVC approach of a kind. The code is a lot cleaner and more maintainable.
The skeleton looks like this:
You should be able to understand the principle from all this.