I'm trying to do something like stackoverflow
Take a link from stackoverflow for example:
Hidden Features of C#?
if you remove the last part (Hidden Features of C#?) it still returns the same result.
For my routing in Global.asax I tried doing something like "{action}/{id}/{title}"
On my page, this is my link:
<%= Html.ActionLink(video.Title, "Details", "Videos", new {id = video.ID, title = video.Title.Replace(" ", "-")}, null) %>
This does what I want it to do for the most part except that after the id it throws in "?title=blah-blah-blah"
I want it to say "id/blah-blah-blah"
What's my problem? (Besides being a noob)
I wrote a blog post on this a while back and thought it might be helpful:
http://web.archive.org/web/20170416234816/http://mynameiscoffey.com/2010/12/19/seo-friendly-urls-in-asp-net-mvc/
Basically you need to check in your action for the presence of the correct SEO-Friendly title when your action is executing, and if it doesn't find it, issue a redirect back to the browser to the correct SEO-Friendly URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With