elmah / Bootstrapper

Configuration-free registration of ELMAH & more
https://elmah.github.io/
Apache License 2.0
25 stars 4 forks source link

How to use in global.asax? #14

Open jfkrueger opened 2 months ago

jfkrueger commented 2 months ago

The readme states: "If you do not want to use Global.asax,.." and then goes on to give an example of a static class and method but I've been looking all over the place to see how to use this if we wanted to use the PreStartInitialize as mentioned earlier in the readme. From what I understand I would use HttpApplication.RegisterModule(elmahErrorModule.GetType) but I'm not getting the connection between that and bootstrapper and how to actually configure the mail settings so that they are not stored in the web.config.

Thanks!

atifaziz commented 1 month ago

From what I understand I would use HttpApplication.RegisterModule(elmahErrorModule.GetType)

This is automatically done on your behalf here:

https://github.com/elmah/Bootstrapper/blob/828c4501db0b67201238752188d3c520ed4836da/Bootstrapper.cs#L45

Ignition.Start internally calls the following method that makes the calls to HttpApplication.RegisterModule:

https://github.com/elmah/Bootstrapper/blob/828c4501db0b67201238752188d3c520ed4836da/Bootstrapper.cs#L213-L221

It registers all of the following modules:

https://github.com/elmah/Bootstrapper/blob/828c4501db0b67201238752188d3c520ed4836da/Bootstrapper.cs#L223-L235

Hope this clears up the connection.