HttpContext.Current在线程中为null [英] HttpContext.Current is null in thread
本文介绍了HttpContext.Current在线程中为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在尝试在我的asp.net应用程序中使用线程作为方法。但在线程方法中,它将HttpContext.Current作为null。有没有解决方案。
在页面加载中:
Hello,
I am trying to use thread for a method in my asp.net 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,
推荐答案
检查以下链接处理相同的问题。
http://odetocode.com/articles/112.aspx [ ^ ]
希望这有助于
Check the below link which handles the same issue.
http://odetocode.com/articles/112.aspx[^]
Hope this helps
HttpContext保存在线程本地存储中。本文可以帮助您解决这个问题:
http://adventuresdotnet.blogspot.com/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:
http://adventuresdotnet.blogspot.com/2010/10/httpcontextcurrent-and-threads-with.html#!/2010/10/httpcontextcurrent-and-threads-with.html[^]
这篇关于HttpContext.Current在线程中为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文