I'm creating an HTTPModule which can be reused a few times, but with different parameters. Think as an example, a request redirector module. I could use an HTTPHandler but it is not a task for it because my process needs to work at the request level, not at an extension/path level.
Anyways, I'd like to have my web.config this way:
<system.webServer>
<modules>
<add name="tpl01" type="TemplateModule" arg1="~/" arg2="500" />
<add name="tpl02" type="TemplateModule" arg1="~/" arg2="100" />
</modules>
</system.webServer>
But most information I could find was this. I say, yeah, I can obtain the whole <modules>
tag, but how do each instance of my HTTPModule knows which arguments to take? If I could get the name (tpl01
or tpl02
) upon creation, I could look its arguments up by name afterwards, but I did not see any property in the HTTPModule class to get that.
Any help would be really welcome. Thanks in advance! :)
I think, this part of config (system.webServer\modules\add ) is not intended to pass(store) parameters to modules, but to register list of modules to process request.
For possible atttributes in "add" element see - https://msdn.microsoft.com/en-us/library/ms690693(v=vs.90).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With