I am creating an ASP.NET MVC app. Currently my links look like:
/Campaign/Overview/996e19da-c5e6-e511-948f-005056822904
/Service/Offer/767619da-c5e6-e511-948f-005056e529a5
I would like them to look like:
/Campaign/Overview/996e19da-c5e6-e511-948f-005056822904/campain-user-friendly-text-taken-from-the-db
/Service/Offer/767619da-c5e6-e511-948f-005056e529a5/service-user-friendly-text-taken-from-the-db
This means that when you access
/Campaign/Overview/996e19da-c5e6-e511-948f-005056822904/
you should get 301 and be redirected to/Campaign/Overview/996e19da-c5e6-e511-948f-005056822904/campain-user-friendly-text-taken-from-the-db
Also, when you post to
/Campaign/Overview/996e19da-c5e6-e511-948f-005056822904/campain-user-friendly-text-taken-from-the-db
and in the method you doreturn View(vm);
it should keep that URL.And last, but not least when you use @Html.ActionLink("Click here", "Overview", "Campaign") I would like it to create the link with the user friendly text (which will be something else in case of campaign and service).
What is the easiest solution to what I want? I can think of things that I can do with routing and some htmlHelper extensions, but I feel like I am making it too complex and that I am reinventing the wheel. Am I?
A smilar question has been asked here: How do I create userfriendly urls like stackoverflow?, but it does not answer my question.