Anyone actually able to capture for component use, a client IP address, in Azure Blazor 9?
This question has been asked for several years, but for previous Blazor versions; IMHO, there isn't a satisfactory answer that applies to .NET Blazor 9. It can't be this difficult.
When running a Blazor InteractiveServer app in Azure, with rendermode of InteractiveServer, it is very difficult to capture the client IP address.
The first time OnInitialize is hit, there is a valid HttpContext. The second time (render), the HttpContext is null. A HttpContext value captured such as remoteipaddress, even in a Scoped service (which is really a Singleton in InteractiveServer mode), is gone. HttpContext is missing. ScopedServices are reinitialized. I disabled prerender, but then the only call to OnInitialized, the HttpContext is null. I get that HttpContext is shady in interactive mode.
Things run stellar in localhost, but once deployed to Azure, the second OnInitialize everything is reinitalized.