0

We have ASP.NET application with Global.asax.cs file where we use application event handlers as following:

protected void Application_Start(object sender, EventArgs e)
{
    log.Info("The App started.");
}

protected void Application_End(object sender, EventArgs e)
{
    log.Info("The App finished.");
}

We want to use OWIN now, which means adding Startup.cs file. Is there any way to move handlers from Global.asax.cs то Startup.cs file or something else where we can put our logs?

tesicg
  • 3,971
  • 16
  • 62
  • 121
  • Possible duplicate of [How to handle former global event handlers in ASP.NET 5?](http://stackoverflow.com/questions/32943156/how-to-handle-former-global-event-handlers-in-asp-net-5) – Marc L. May 26 '16 at 16:48

1 Answers1

0

OwinContext in Startup.Configuration() is different from the traditional ASP.NET HttpContext which exists in MvcApplication.Application_Start(). Both are using different pipelines. And because of that you can't use MvcApplication.Application_Start() in Startup.Configuration()

Dawid Rutkowski
  • 2,658
  • 1
  • 29
  • 36
  • What do you mean by workaround? Everything which you were doing in global.asax is also possible in ASP.NET 5, but in different way. – Dawid Rutkowski Oct 02 '15 at 08:48
  • Ok. How could it be done in ASP.NET 5? I mean on putting log somewhere in order to register start and end of application. – tesicg Oct 02 '15 at 09:13