I created a Blazor client app and and within this app I have a number of authorization policies with custom requirements and handlers. One of them checks the ID requested in the URL and checks whether the logged in user can view this resource.
For example, through the client, the user navigates to https://localhost/resource/1f28e41c-bc75-44d6-9eef-d46b66b649c7 which is a resource on my API.
Iām using the following code to see the request path:
var httpContext = _httpContextAccessor.HttpContext;
string requestedPath = httpContext.Request.Path.ToString();
This used to work and requestedPath would indeed contain the value ā1f28e41c-bc75-44d6-9eef-d46b66b649c7ā
However, in the _Host.cshtml I have changed the render mode from "ServerPrerendered" to "Server". This was due to the fact that the code was executed twice at different places during page invocation.
And since I changed this, the requestedPath value is always "/_blazor".
So I was wondering, in a blazor app, is it possible to get the requested path if the render mode is set to "server"?