There is no way to this code run on .NET Core, on
ASP.NET Core the static HttpContext.Current property of System.Web is not used and always be null.
For example, the best way to manage sessions on
ASP.NET Core is to configure ISessionFactory (as singleton) and ISession (as scoped) on DI on ConfigureServices method of the Startup class like bellow.
services.AddSingleton<NHibernate.ISessionFactory>(factory =>
{
return new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
});
services.AddScoped<NHibernate.ISession>(factory => factory.GetRequiredService<NHibernate.ISessionFactory>().OpenSession());
After that you must change the code that uses the old static class to be dependent on ISession interface (add an ISession parameter to the constructor).
I don't know if you are using this hashtable to manage sessions, but I assuming it because you posted your message on an NHibernate group.