I would like to map a route that would be valid for any number of parameter passed as a query string for any controller and methods.
For instance:
/Area/Controller/Action?paraA=1¶B=2
should be changed to
/Area/Controller/Action/paraA/1/paraB/2
The standard mapping only works for an id parameter. I want to update it so that it works for any number of parameters. Any suggestions?
Standard implementation is
app.MapControllerRoute(
name: "MyArea",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
According to your description, the asp.net core route template contains the a catch-all parameter.
You could put it like below:
If you put the /Area/Controller/Action/1/2/3/4 inside the url, the controller method will capture it like below:
Then you could use Split method to split it and use it.