Loading

c# 异步方法中HttpContext.Current为空

调用异步方法前

 HttpContext context = System.Web.HttpContext.Current;
 HttpRuntime.Cache.Insert("context", context);

异步方法里

 HttpContext context = HttpContext.Current;
 if (context == null)
 {
     context = HttpRuntime.Cache.Get("context") as HttpContext;
 }

摘自:https://blog.csdn.net/chenjian88886666/article/details/82959252

posted @ 2019-12-16 17:51  WeiYongZhi  阅读(1409)  评论(0编辑  收藏  举报