Mein Problem, das ich jetzt habe, ist, dass ich den Zugriff immer noch anonym gewähren möchte, wenn ich mich im Debugging-Modus befinde. Für die Controller-Authentifizierung verwende ich:
Code: Select all
app.MapControllers().WithMetadata(new AllowAnonymousAttribute());
Code: Select all
app.MapFallbackToFile("/StaticFiles/{*filepath}").WithMetadata(new AllowAnonymousAttribute());
Die statische Dateifunktion ist:
Code: Select all
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, staticFiles)),
RequestPath = "/StaticFiles"
});
Vielen Dank