2015-10-06 21 views
2

我們使用ASP.NET 4.5(VS 2013),並想用新的Startup.cs文件取代Global.asax.cs,該文件來自OWIN規範。如何使用OWIN在ASP.NET 4.5中處理Application_AcquireRequestState,Session_Start和Session_End?

我們需要將Application_AcquireRequestState,Session_Start和Session_End處理程序替換爲Startup.cs文件中的某些內容。它在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); 
} 

我們該怎麼做?

回答

1

OWIN沒有會話定義,並且不能完全替換Global.asax.cs文件。

嘗試使用ASP.NET 5,它將所有內容從Global.asax.cs移動到Startup.cs。 https://github.com/aspnet/home

相關問題