Blazor - Using HttpContext in a DLL

45 Views Asked by At

I have a Blazor Server .NET 8 web application that uses HttpContext for some tasks. At first, I can access HttpContext without any problem, then the code executes a second time (pre-render?) and HttpContext becomes null.

My application also calls a DLL, which also retrieves HttpContext.Current. I'm obliged to use HttpContext due to corporate criteria, as the DLL has been migrated from .NET Framework to .NET Core.

Thanks in advance. Max

EXAMPLE

I've tried disabling the pre-render or changing my Program.cs but it doesn't work.

Is it possible to use HttpContext? Or do I have to use another library?

0

There are 0 best solutions below