Answer the question
In order to leave comments, you need to log in
ASP .NET Core: Routing. How to make multiple categories at the beginning of a URL?
So, there is a task:
It is necessary to skip requests for the url site.com/events/2017/06/wwdc.html
, or in a more general form
site.com/category1/subcategory1/subcategory2/...../subcategoryN/page-title.html
site.com/cars/tesla/model-s/is-it-worth-it.html
ArticlesController
Index(string title)
/pageTitle.html
Answer the question
In order to leave comments, you need to log in
If you put something like this at the end of the file, then everything should work, but you have to manually parse everything.
app.UseMvc(routes =>
{
routes.MapRoute(
name: "category-article",
template: "{*article}",
defaults: new
{
controller = "Home",
action = "ReadCategoryAndPage"
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question