We often write ASP.NET modules to customize ASP.NET processing pipeline - extend security, etc.
However, as modules are static, in a sense that a module is active or inactive in processing pipeline, applications which "host" modules are dynamic, in a sense that different applications work under different conditions.
The issue we've faced recently was to inject a custom, application specific code into module:
The solution we've came up with was rather simple: we've used a custom provider to provide application-specific code.
This way we can configure different providers on the application level but still be able to write generic module code: