问:
In asp.net mvc we used to decorate controller for disabling session state by using attribute as [SessionState(System.Web.SessionState.SessionStateBehavior.Disabled)] How we can do it in ASP.NET Core?
答:
There is no need for it. Unlike old asp.net, session is not locked for a request. This allows the session handler to only be called if you access a session value. So if your action does not access session, session is not loaded, nor is it written back.
You can find reference here which mentioned that session is not locked.
Session and app state in ASP.NET Core
在ASP.NET Core中,与旧版ASP.NET不同,会话不会被请求锁定。这允许会话处理器仅在访问会话值时被调用。如果操作未访问会话,则不会加载会话,也不会回写。因此,在ASP.NET Core中无需专门禁用会话状态。
244

被折叠的 条评论
为什么被折叠?



