The Geolocation API can only be used via JavaScript. Here’s a Blazor component that wraps all the interop code. Now you can get device position using C# only.
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed