asp.net mvc 4 - HttpContext.Current.Session is NULL inside async Task [.NET 4] -


httpcontext customcontext = httpcontext.current;  task task = new task(() => {     httpcontext.current = customcontext;     // httpcontext.current.session shows null      // logic goes here });  task.start(); 

i read question in site & found

as httpcontext bound thread, that's why null in task.

so that, save context in other variable try use it. works fine in case of httpcontext.current.request.cookies, httpcontext.current.session gives me null.

any explanation or appriciated.


Comments

Popular posts from this blog

java - Could not retrieve pre-bound Hibernate session - Could not obtain transaction-synchronized Session for current thread -

java - ConcurrentModificationException upon committing transaction with Hibernate -

java - Not entering the success part of http response in angularjs using spring mvc -