I'm using .Net Core MVC 3.0 which defaults to Endpoint Routing
The default route config is:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Link}/{action=Index}/{id?}"
});
That will allow me to do CRUD operations on my "Links"
e.g. /Link/Edit/123
What I need to be able to do is catch and route any request which is NOT a CRUD operation to another controller and action
e.g. /blahblah
So that I can process them as I like (probably a redirect, maybe just a friendly notice, could be anything!)
Back in my .Net Framework MVC, one would add a route config like this:
routes.MapRoute(
name: "MyCatchAll",
url: "{key}",
defaults: new { controller = "MyController", action = "MyAction" },
constraints: new { key = new MyConstraint() }
);
(the purpose of the constraint is simply an optional check that I might need to use for example, to ensure that blahblah matches an expected value)
However, I cannot get this to work in .Net Core MVC 3.0
Any pointers would be most appreciated.