I have a list of puzzles that are tagged with specific βthemesβ. Think about stackoverflow related issues with tags of specific categories.
I am trying to configure a route so that it works as follows:
http://www.wikipediamaze.com/puzzles/themed/Movies
http://www.wikipediamaze.com/puzzles/themed/Movies,Another-Theme,And-Yet-Another-One
My routes are configured as follows:
routes.MapRoute(
"wiki",
"wiki/{topic}",
new {controller = "game", action = "continue", topic = ""}
);
routes.MapRoute(
"UserDisplay",
"{controller}/{id}/{userName}",
new {controller = "users", action = "display", userName=""},
new { id = @"\d+" }
);
routes.MapRoute(
"ThemedPuzzles",
"puzzles/themed/{themes}",
new { controller = "puzzles", action = "ThemedPuzzles", themes = "" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new {controller = "Home", action = "Index", id = ""}
);
My controller is as follows:
public ActionResult ThemedPuzzles(string themes, PuzzleSortType? sortType, int? page, int? pageSize)
{
}
My invocation of the action link in the views is as follows:
<ul>
<%foreach (var theme in Model.Themes)
{ %>
<li><%=Html.ActionLink(theme, "themed", new {controller = "puzzles", themes = theme})%></li>
<% } %>
</ul>
However, the problem I encountered is this:
The generated links appear as follows:
http:
, "" null. querystring . ,
http://www.wikipediamaze.com/puzzles/themed/MyThemeNameHere
http://www.wikipediamaze.com/puzzles/themed/MyThemeNameHere,Another-ThemeName
. ?
!