Reputation: 608
I have a view setup as:
I then have my Business controller:
[Route("{business}/{url}")]
public IActionResult business(string url)
{
return View();
}
My aim is to be able to pass the url string 'neatly' like so
https://website.com/business/business-name-123
The business-name-123
is then received as the parameter.
I have created something similar to this before where you pass ?query=website-name
but I don't want this, can someone explain what I need to do to get this working using just the / routing aspect?
Upvotes: 0
Views: 179
Reputation: 10874
Remove the braces around {business}
in your route template. Business is a constant string, not a route parameter:
[Route("business/{url}")]
Upvotes: 2