How do you redirect a request in ASP.NET MVC to its correct canonical version if part of the URL is missing?
Using Stack Overflow as an example, the site adds the question title to the end of its routes, but uses the question ID in the route to actually find the question. If the title gets omitted you will be redirected to the correct URL.
For example, visiting the URL:
stackoverflow.com/questions/9033
will redirect to
stackoverflow.com/questions/9033/hidden-features-of-c
How does this work?