I’m building a website using ASP.NET Core. The site serves the same content types, but with unique content, for different cities. The site also serves content that isn’t city-specific, like the site’s “About” and “Contact” pages, and its administrative interface.
URLs for city-specific content should include the city name for SEO benefits, as seen in these examples:
http://example.com/new-york-ny/news http://example.com/los-angeles-ca/news
After exploring different ways to handle the city-specific content, I implemented the feature by customizing ASP.NET Core’s route constraints and model binding. Read on for an explanation and example code of how it works. [Read more…] about Customizing ASP.NET Core’s Route Constraints and Model Binding