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

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -