diff --git a/MyApp/Components/Pages/Docs.razor b/MyApp/Components/Pages/Docs.razor index 64edc71..858e26a 100644 --- a/MyApp/Components/Pages/Docs.razor +++ b/MyApp/Components/Pages/Docs.razor @@ -1,4 +1,4 @@ -@page "/{Slug?}" +@page "/{Slug:regex(^[a-z-_]+$)}" @inherits AppComponentBase @inject MarkdownPages Markdown @inject AppConfig AppConfig diff --git a/MyApp/Configure.AppHost.cs b/MyApp/Configure.AppHost.cs index 4a1cd4e..1a741aa 100644 --- a/MyApp/Configure.AppHost.cs +++ b/MyApp/Configure.AppHost.cs @@ -19,9 +19,7 @@ public class AppHost : AppHostBase, IHostingStartup public override void Configure(Container container) { SetConfig(new HostConfig { + IgnorePathInfoPrefixes = { "/appsettings", "/_framework" }, }); - - Config.AllowFileExtensions.Add("json"); - Config.AllowFileExtensions.Add("dat"); } } diff --git a/MyApp/Program.cs b/MyApp/Program.cs index 4f3d545..3f3477c 100644 --- a/MyApp/Program.cs +++ b/MyApp/Program.cs @@ -82,11 +82,6 @@ .AddInteractiveWebAssemblyRenderMode() .AddAdditionalAssemblies(typeof(Counter).Assembly); -// Add support for serving static *.json files from WebAssembly -IResult StaticJsonFile(HttpContext context) => Results.File(context.Request.Path.Value![1..], MimeTypes.Json); -app.MapGet("/appsettings.json", StaticJsonFile); -app.MapGet("/appsettings.Development.json", StaticJsonFile); - // Add additional endpoints required by the Identity /Account Razor components. app.MapAdditionalIdentityEndpoints();