Click here to Skip to main content
15,889,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public class CHttpModule : IHttpModule
   {
       private static IHttpModule RetrieveModule()
       {
           return DependencyResolver.Current.GetService<IHttpModule>();
       }

       public void Init(HttpApplication context)
       {

           context.Error += new EventHandler(HandleException);
       }

       public void Dispose()
       {

       }

     private void HandleException(object sender, EventArgs e)
     {

     }

     public CHttpModule(ILogger temp)
     {
     }

}

As we have to register module before initialization of application .
So it give error on DI.
Posted
Updated 16-Sep-14 2:35am
v2
Comments
Nathan Minier 16-Sep-14 9:14am    
Yeah...your DI isn't set. There is not DependencyResolver.Current because that's added as part of the application object construction.

You could create an instance of the Resolver, call GetService on it, and Dispose it in your function I suppose.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900