Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use in global.asax? #14

Open
jfkrueger opened this issue Jul 19, 2024 · 1 comment
Open

How to use in global.asax? #14

jfkrueger opened this issue Jul 19, 2024 · 1 comment

Comments

@jfkrueger
Copy link

jfkrueger commented Jul 19, 2024

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
Copy link
Member

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

This is automatically done on your behalf here:

[assembly: PreApplicationStartMethod(typeof(Ignition), "Start")]

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

static void StartImpl()
{
// TODO Consider what happens if registration fails halfway
ServiceCenter.Current = GetServiceProvider;
foreach (var type in DefaultModuleTypeSet)
HttpApplication.RegisterModule(type);
}

It registers all of the following modules:

static IEnumerable<Type> DefaultModuleTypeSet
{
get
{
yield return typeof(ErrorLogSecurityModule);
yield return typeof(ErrorLogModule);
yield return typeof(ErrorMailModule);
yield return typeof(ErrorFilterModule);
yield return typeof(ErrorTweetModule);
yield return typeof(ErrorLogHandlerMappingModule);
yield return typeof(InitializationModule);
}
}

Hope this clears up the connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants