2

I have a class Application that my global.asax inherits from. The class has this method:

protected void Application_Start(object sender, EventArgs e)
{
    // ...
}

In my understanding this is basically an event handler that is automatically added to an event (based on the method name [*]). I tried to find out what event exactly, so I put a breakpoint inside the method and checked the call stack:

Foo.DLL!Foo.Application.Application_Start(object sender = {System.Web.HttpApplicationFactory}, System.EventArgs e = {System.EventArgs})

The sender is System.Web.HttpApplicationFactory, but I can't find that class using the Object Browser in Visual Studio 2008 or on the MSDN library website.

Where can I find more information about this class?

Thank you!


[*] Compare it to the Application_BeginRequest(object sender, EventArgs e) method, which is added as a handler to the BeginRequest event of the System.Web.HttpApplication class.

Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132

2 Answers2

5

HttpApplicationFactory is an internal class defined in System.Web.dll. You can check it out in .NET Reflector if you are interested.

Internal means that it is not normally visible outside the dll where it is defined, so you can't use it in your own code.

Rune Grimstad
  • 35,612
  • 10
  • 61
  • 76
  • is there any wrapper that i can use to use Httpapplicationfactory ? – Vishal Sharma Jul 18 '14 at 05:51
  • Nopes, it is internal, so you can't subclass it. But you can see the source online: https://github.com/Microsoft/referencesource/blob/master/System.Web/HttpApplicationFactory.cs. – Ricardo Peres Dec 02 '14 at 12:22
2

Like Rune said, HttpApplicationFactory is an internal class defined in System.Web.dll.

What it does is create the application and start it, basically managing the runtime of your web application.

configurator
  • 40,828
  • 14
  • 81
  • 115