locked
Handle application level events/errors globally outside Global.asax file RRS feed

  • Question

  • Hi,

    I Am creating one small application, in this i don't want to use Global.asax file but i need to handle following events outside Global.asax

    1. App_Start()
    2. Session_Start()
    3. Application_BeginRequest()
    4. Application_Error()
    5. Session_End()
    6. Application_AuthenticateRequest()

    For Application_Start() i have found  [assemblyPreApplicationStartMethod(typeof(ClassLibrary.Startup), "Start")] attribute.

    Is there any alternate way to handle other events outside Global.asax file? If its there please provide suggestions.
    • Moved by CoolDadTx Thursday, July 20, 2017 3:05 PM ASP.NET related
    Thursday, July 20, 2017 6:14 AM

All replies

  • Have you considered to still use Global.asax, but calling some members or static functions of your class, for example:

    void Session_Start(object sender, EventArgs e)
    {
       MyClass.ProcessSessionStart();
    }

    Thursday, July 20, 2017 7:18 AM
  • Thanks for suggestion but i don't want to use Global.asax 

    Thursday, July 20, 2017 8:51 AM
  • Please post questions related to ASP.NET in the ASP.NET forums.
    Thursday, July 20, 2017 3:05 PM