We were using the following solution to get the remote IP address of the client computer when running Blazor server.
We inject IHttpContextAccessor into the _Host.cshtml file and store the RemoteIpAddress.
@inject IHttpContextAccessor httpContextAccessor;
@{
var remoteIpAddress =
httpContextAccessor.HttpContext.Connection?.RemoteIpAddress.ToString();
}
...
<component type="typeof(App)" param-RemoteIpAddress=remoteIpAddress
render-mode="Server" />
You can read the full details here. How do I get client IP and browser info in Blazor?
I'm now upgrading the code the .NET 8 and am in the process of replacing the _Host.cshtml with the App.razor. So I'm wondering if there is any change to this solution now that I'm using .NET 8 and have no _Host.cshtml. Maybe I'm overthinking things here, but unfortunately for me to test it I need to deploy it and I don't have a fee environment to test this in right now.