I have an application which is built using both client side routing using react and server side routing using MapRazorPages. I need to map tasks/*
to a specific view and map everything to razor pages. I'm completely new to dotnet so I don't really know what I'm doing but so far as I can tell I should be able to do something like this:
~/Startup.cs:
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapControllerRoute("tasks", "{controller=Tasks}/{action=Index}/{id?}");
});
~/Controllers/TasksController.cs:
using Microsoft.AspNetCore.Mvc;
namespace Web.API.Controllers.UI
{
public class TasksController : Controller
{
public IActionResult Index()
{
return View("../../Pages/Tasks");
}
}
}
But that returns an empty response and I'm guessing also wouldn't work on anything other than tasks/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…