HttpContext.Current在线程中为null

编程入门 行业动态 更新时间:2024-10-17 19:30:45
本文介绍了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

本文发布于:2023-11-13 15:05:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584658.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:线程   中为   HttpContext   Current   null

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!