Is it possible to define a large portion, if not the entire, web.config of an ASP.NET application in code? If so, how? Would you use an IHttpModule? In the same vein, can you resolve an IHttpHandler within said module to handle all incoming requests?
Edit 1: The last bit was instigated by this answer to another question.
Edit 2: What I really want to do is add/remove modules and handlers in code as opposed to the web.config. I probably need to at least set a module in the web.config that would allow this. Can I then register additional modules and handlers? I'm just exploring possibilities.