I am trying to write async code in asp.net 4.8 but and the problem is that HttpContext is null after returning from await. This means that the async code works correctly which is good, but the HttpContext is needed by the original code. From the comments in below answer by Darin Dimitrov it shows that HttpContext is having this issue since 4.6.1. Why is HttpContext.Current null after await?
var domains = HttpContext.Current.Cache.Get("domains") as Dictionary<String, Domains>;
if (domains == null)
{
var x = await TrackingMethods.GetTableForCacheAsync().ConfigureAwait(false);
domains = x.domains;
}
/// HttpContext.Current is null here