tesicg
tesicg

Reputation: 4053

How to handle Application_AcquireRequestState, Session_Start and Session_End in ASP.NET 4.5 using OWIN?

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 need to replace Application_AcquireRequestState, Session_Start and Session_End handlers with something in Startup.cs file. It looks as following in Global.asax.cs:

protected void (Object sender, EventArgs e)
{
    SessionCounter.AddSessionPage(Context);
}

protected void Session_Start(Object sender, EventArgs e)
{
}

protected void Session_End(Object sender, EventArgs e)
{
    LoginLog.RegisterLogOff(Context);
    SessionCounter.AbandonSession(Context);
}

How can we do that?

Upvotes: 2

Views: 911

Answers (1)

Tratcher
Tratcher

Reputation: 6084

OWIN has no definition for session and cannot fully replace the Global.asax.cs file.

Try ASP.NET 5, it moves everything from Global.asax.cs to Startup.cs. https://github.com/aspnet/home

Upvotes: 1

Related Questions