views:

17

answers:

1

I have a httpmodule that contains a property.

The httpmodule is used in my web application. I want to set the property in the httpmodule when my application starts and not have the overhead of setting it everytime the module is called.

The value for the application is read from my app settings in the web.config.

The httpmodule resides in a seperate dll to the web application.

So I want to inject/set the property from my web application on application start.

Any tips as to how I can achieve this?

+1  A: 

Well, the application controls the creation and collection of modules, and beyond that IIS maintains a pool of application instances, so I don't think you can just set it once and be done with it.

I think the way to go would be to derive a class from HttpApplication and put your property there. When constructed, the application can read the app setting (meaning the config file access only happens once), and then when modules need it they can get it very efficiently from the Application, without touching the file system.

KeithS