Solid.Extensions.System.Web is a library for patching HttpContext.Current to be more async friendly. This library is built for .Net Framework 4.6.1 and above.
We do not recommended using this library in any new applications. You should always try to have your stack be fully async instead of using Task.Run or any other variation of that within sync methods.
If you are, however, up against the wall and have a sync stack already and need to use async methods, you can try this library out and see if it works for you.
This is written for ASP.Net applications. This is not for AspNetCore applications.
Just reference the library. When the ASP.Net application starts, it will patch HttpContext.Current for you.
public string GetString()
{
HttpContext.Items["Hello"] = "World";
return HttpContext.Current.Run(() => GetStringAsync());
}
private async Task<string> GetStringAsync()
{
return $"Hello {HttpContext.Current.Items["Hello"]}";
}