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<
In my application there are a lot of code that uses HttpContext.Current
and I can not modify that code.
worker.DoWork()
from sample below uses that code. And I had to run it in separate thread.
I came to the following solution:
HttpContext ctx = HttpContext.Current;
Thread t = new Thread(new ThreadStart(() =>
{
HttpContext.Current = ctx;
worker.DoWork();
}));
t.Start();
// [... do other job ...]
t.Join();