3

I am trying to implement MembershipProvider with IoC described in this article: http://bugsquash.blogspot.cz/2010/11/windsor-managed-membershipproviders.html

But I have some problems with my MvcApplication class which is implementing IContainerAccessor. But when I am trying to access the container by following code in MyMembershipProvider the container is null reference.

(HttpContext.Current.ApplicationInstance as IContainerAccessor).Container

I found that there is second instance of MvcApplication which method Application_Start() was not called. Therefore no instance was set to Container property.

Why there is second instance of MvcApplication class? I thought that there will be only one instance. And how come that Application_Start() was not called?

I am using .net4 and mvc3.

Lukas Pirkl
  • 1,417
  • 3
  • 15
  • 31

1 Answers1

2

I finally found answer. My question is related to this one Application_Start ASP.NET

And informations about instances of HttpApplication class is in this blog post http://blog.andreloker.de/post/2008/05/HttpApplication-instances.aspx which is answer I was looking for.

Community
  • 1
  • 1
Lukas Pirkl
  • 1,417
  • 3
  • 15
  • 31