views:

62

answers:

1

I'm trying to do something like stackoverflow

Take a link from stackoverflow for example:

http://stackoverflow.com/questions/9033/hidden-features-of-c

if you remove the last part (http://stackoverflow.com/questions/9033) 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)

+1  A: 

That route looks like it should work with that call to ActionLink, so this is a bit of a guess. Are you registering your "{action}/{id}/{title}" route after the default route? If so, the default route will match first, and just put the title value in the querystring since it doesn't appear in the path. If you register your custom route before the {controller}/{action}/{id} default, it should work.

stevemegson
It is registered before the default route, however, you did point me in the right direction. It actually did come down to the actual sequence of the registered routes. thank you
Muad'Dib