i have asp.net mvc 3 site with Forms Authentication and Session with SQLServer mode. Today I try to set authentication mode="None" and store auth-token in cookie (because authorization token i get from remote service) and check is cookie exist at Application_BeginRequest
in global.asax
, if no - user redirected to logon page.
After authetication I store user in session: HttpContext.Current.Session[userToken]
.
When I set authentication mode="None" at first look it works as expected - user redirected to logon, s开发者_如何学JAVAubmit form with login and password and after that, on next request HttpContext.Current.Session is null.
I don't know why it becomes null?
When you are accessing the Session[userToken] in the BeingRequest event of your Request pipeline, The Session has not been loaded yet.
精彩评论