I'm new to .NET Core and I'm working on an ASP.NET Core MVC app.
I'm trying to make available a file that was generated from backend. The physical path is (root) Cards/id/index.html. My problem is that when I execute my web app, I cannot browse that file.
For example:
localhost:Card/id/index.html
I know that i have to add something to my middleware but I can't fix it.
Here is my startup.cs code
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"cards")),
RequestPath = new PathString("/personal-cards")
});
app.UseRouting();
app.UseEndpoints(x => {
x.MapRazorPages();
x.MapControllerRoute(name:"Default",
pattern: "{Controller}/{action}/{id?}",
defaults: new {controller = "Home", Action="Index"});
});
}
Can you help me?