本文介绍了HttpContext.Current在线程中为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好, 我正在尝试在我的asp应用程序中使用线程作为方法。但在线程方法中,它将HttpContext.Current作为null。有没有解决方案。 在页面加载中:
Hello, I am trying to use thread for a method in my asp application. But in thread method its giving HttpContext.Current as null. Is there any solution for this. In pageload :
Thread t1 = new Thread(new ThreadStart(populateProfile)); t1.Start();在populateProfile方法中,HttpContext为null。 谢谢,
In populateProfile method HttpContext is null. Thanks,
推荐答案检查以下链接处理相同的问题。 odetocode/articles/112.aspx [ ^ ] 希望这有助于 Check the below link which handles the same issue. odetocode/articles/112.aspx[^] Hope this helps
HttpContext保存在线程本地存储中。本文可以帮助您解决这个问题: adventuresdotnet.blogspot/2010/10/httpcontextcurrent-and-threads-with.html#!/2010/10/ httpcontextcurrent-and-threads-with.html [ ^ ] The HttpContext is kept in thread local storage. This article may help you solve that: adventuresdotnet.blogspot/2010/10/httpcontextcurrent-and-threads-with.html#!/2010/10/httpcontextcurrent-and-threads-with.html[^]
更多推荐
HttpContext.Current在线程中为null
发布评论