2
votes

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, submit form with login and password and after that, on next request HttpContext.Current.Session is null. I don't know why it becomes null?

1
You are asking us to imagine what your code looks like. Unfortunately it doesn't work that way. Post some code and we can help.. Maybe :) - Code Jammr
I can think of a few reasons maybe, need some code man - Code Jammr
Maybe your cookie expires? Did you set the expiration time? If you did not, then it will be destroyed after each session. - bobek
Still no code? We need to see how you are setting your FormsAuthTicket - Code Jammr

1 Answers

0
votes

When you are accessing the Session[userToken] in the BeingRequest event of your Request pipeline, The Session has not been loaded yet.