Hi SherryPatter-2252,
According to your route, it seems you want to match the home controller's routes. But inside your pattern, it doesn't contain any controller information.
For this kind of situation, we suggest you could consider using the attribute route. Besides, the attribute route support token replacement feature which could achieve your requirement. Notice this feature is not supported by the Conventional routing(This is the reason why your route will match all the pattern).
More details, you could refer to below codes and this article:
[Route("Blog/Do[action]")]
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
- List item