c # asynchronous process is empty HttpContext.Current

Before calling the asynchronous method

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

Asynchronous methods in

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

Excerpt: https://blog.csdn.net/chenjian88886666/article/details/82959252

Guess you like

Origin www.cnblogs.com/WeiYongZhi/p/12050386.html