I have some legacy URLs that I need to route properly and efficiently. I have a new ASP.Net Core application with some pretty standard routing. I have to support legacy links that might come in through emails, bookmarks, etc. The links have a format that is one 'segment', like so:
[login to view URL]
http://www/[login to view URL]
From the above, I know that for the first one, I might need to redirect to the 'team' controller, then do a database lookup for the name 'san-diego-padres'. For the second one, it might be the players controller, the index action, with an id of 'steelers'.
The URLs contain information that is both required to properly route the request to the specific information, and some information that can be safely ignored.
The obvious answer would be to create a route that didn't conflict with any of the controller names, parse the data to see how it should be routed, and redirect accordingly, but it seems that there would be a better approach. I can't really use the catch-all wildcard since it would have to be at the beginning of the segment. I have about 20 or so variations that I need to support, some with the id data at the beginning, some in the middle, and some at the end.
Interested in a best practice solution that doesn't change any of the existing URLs. Note that this is not really a project, if someone has a short solution that I can quickly try and confirm that it works, they will get paid! Thanks!