I'd like to add a trailing slash to any url's that match a valid route but do not currently end in a slash, i.e. www.example.com/url
After a url is matched to a valid route I would like to 301 redirect to the same url but add the trailing slash i.e. www.example.com/url/
I've spent some time looking into it but I can't seem to figure it out.
I believe routes are matched in the PostResolveRequestCache event, but I don't know how to access the routedata during or after that event to see if a valid route was matched. If I can confirm that a valid route was matched then I can check the url to make sure it ends in a slash.
I hope that's clear enough, let me know if you need more info.