I have a rute in my asp.net mvc 2 site that looks like this
routes.MapRoute(
"media_display",
"Media/{mediaId}-{mediaName}",
new { controller = "Media", action = "Display" },
new { mediaId = @"\d+" }
);
Where mediaId is the id, and mediaName is the title of the media. An example
www.example.com/Media/1-test-media-list
Where the id is 1, and the name is "test media list", the problem here is that i replace space " " with -, and that ruins my route.
I just can't figure out how to make this so "mediaName" can contain a -.
i also have the following rute, but the solution should be the same.
routes.MapRoute(
"media_display",
"Media/{mediaId}-{mediaName}/edit",
new { controller = "Media", action = "Edit" },
new { mediaId = @"\d+" }
);
Also are it possible to make a route that will catch all the following 3 exampels, right now do i just have 3 different routes, but i would like to cut this down.
www.example.com/Media/1-test-media-list
www.example.com/Media/1-
www.example.com/Media/1