ASP.Net Identity and export controller

I've been bashing my head against this issue for a few days now and must be missing something basic...

I have implemented ASP.NET identity security using Radzen Studio, and all pages are working correctly with authorization except when the export functions generated by the scaffolding process are called. Prior to implementing the security, the exports were functioning correctly, however since then I've been consistently getting the following error:

InvalidOperationException: 'RemoteNavigationManager' has not been initialized.
BedrockSIS.SecurityService..ctor(NavigationManager navigationManager, IHttpClientFactory factory) in SecurityService.cs
            this.baseUri = new Uri($"{navigationManager.BaseUri}odata/Identity/");

I've read through the security articles and have implemented global authorization in Program.cs, but that hasn't resolved the issue. Looking further into it I think it has to do with the export functions' use of httpget, but perhaps I'm missing something as I can't find any topics about this issue when searching.

Am I missing something?

Hi @Rhys_Griffiths,

Please provide more info about your implementation.

  1. What application did your create (.NET version, rendering mode)?
  2. How did you use authentication with the export controller?

Thanks for the reply. I'm using .NET 8.0 for a Blazor Web Application connecting to an MS SQL server.

I've decorated the ExportController class with [Authorize] tags for now. I intended to include a roles attribute once it was working but haven't got that far yet.

What rendering mode are you using - server, auto or web assembly?

Ah sorry I misunderstood. Using Auto.

I just tested that but cannot reproduce any exceptions. Here is my test application which uses the Northwind database. (377.1 KB)

Thanks for sending that through.

I'm going through and comparing it to my project. So far my securityservice.cs and ExportController.cs are identical (I didn't make any changes so no surprises there) and my version of ExportNorthwindController is structurally identical (except using my data source, naturally).

I've just created a new project and synced up the data source and security. Seems to be working in there so who knows why it's not working in the original project... I'll just take the L and copy across my pages.

Thanks for the help!