How to handle former global event handlers in ASP.

2019-07-13 20:17发布

Actually, we use ASP.NET 4.5 (VS 2013) and want to replace Global.asax.cs with new Startup.cs file, which comes from OWIN specification.

We log the start and the end of application using Application_Start and Application_End handlers in this way:

protected void Application_Start(object sender, EventArgs e)
{
    _log.Info("The app starts.");
}

protected void Application_End(object sender, EventArgs e)
{
    _log.Info("The app ends.");
}

But, as I know there is no such handlers in the new Startup.cs file. So, my question is - how can we do that?

标签: asp.net owin
1条回答
Root(大扎)
2楼-- · 2019-07-13 20:52

You already know when the application is starting since Startup.cs is executing then. For the Application_End event have a look at this answer: Is there Application_End from Global.asax in Owin?

查看更多
登录 后发表回答