This may be a workaround for your problem.
First, define your module with fields for what you need to install from the outside:
public class TemplateModule : IHttpModule { protected static string _arg1; protected static string _arg2; public void Init(HttpApplication context) { _arg1 = "~/"; _arg2 = "0"; context.BeginRequest += new EventHandler(ContextBeginRequest); }
Then from your web application, every time you need to use a module with a different set of these values, inherit the module and redefine the fields:
public class TemplateModule01 : Your.NS.TemplateModule { protected override void ContextBeginRequest(object sender, EventArgs e) { _arg1 = "~/something"; _arg2 = "500"; base.ContextBeginRequest(sender, e); } } public class TemplateModule02 : Your.NS.TemplateModule { protected override void ContextBeginRequest(object sender, EventArgs e) { _arg1 = "~/otherthing"; _arg2 = "100"; base.ContextBeginRequest(sender, e); } }
source share