Access HttpContext.Current from different threads

前端 未结 5 2080
轻奢々
轻奢々 2020-11-27 02:23

I have a C# ASP.NET application which starts about 25 different threads running some methods in a class called SiteCrawler.cs.

In HttpContext.Current.Session<

5条回答
  •  广开言路
    2020-11-27 03:18

    Just add the HttpContext.Current to the constructor of your class SiteCrawler.cs

    public class SiteCrawler
    {
         HttpContext context = HttpContext.Current;
    
        public void Method()
        {
            context.WhateverYouWant
        }
    }
    

提交回复
热议问题