iam using ninject.web extension in my web application but now i have a problem reolving a dependence in Session_Start method of global.asax
this is my global.asax
public class Global : NinjectHttpApplication
{
[Inject]
IUserManagement um { get; set; }
protected void Session_Start(object sender, EventArgs e)
{
if (WebUser.user != null)
{
if (HttpContext.Current.Session[ChiaveSessioneUtente] == null)
{
if (HttpContext.Current != null)
HttpContext.Current.Session.Add(ChiaveSessioneUtente, um.ResolveRequestingUser(Request));
}
}
protected override IKernel CreateKernel()
{
var kernel = new StandardKernel();
RegisterServices(kernel);
return kernel;
}
private void RegisterServices(IKernel kernel)
{
var modules = new List<INinjectModule>
{
new BusinessLogicModule(),
};
kernel.Load(modules);
}
}
Ninject module
public class BusinessLogicModule : NinjectModule
{
public override void Load()
{
Bind<IBusinessInquiry>().To<BusinessInquiry>();
Bind<IUserManagement>().To<UserManagement>();
}
}
but when i start application um
is null, even if via debug i see that CreateKernel
is executed before Session_Start
i also try the nuget package version of ninject.web with NinjectWebCommon
but the result is the same: property is not injected and is null
instead in my webForm all property injected works without problem, so problem is only with global.asax
or session_Start
method