First of all your controller action shouldn't look as it currently does. All controller actions should return an ActionResult and you shouldn't be HTML encoding parameters inside. That's the responsibility of the view:
public ActionResult Browse(string genre)
{
string message = string.Format("Store.Browse, Genre = {0}", genre);
// the cast to object is necessary to use the proper overload of the method
// using view model instead of a view location which is a string
return View((object)message);
}
and then in your view display and HTML encode like this:
<%= Html.DisplayForModel() %>
Now back to your question about handling urls like this. You could simply define the following route in your Global.asax
:
routes.MapRoute(
"Default",
"{controller}/{action}/{genre}",
new { controller = "Home", action = "Index", genre = UrlParameter.Optional }
);
and then http://localhost:2414/Store/Browse/rock
will invoke the Browse
action on the Store
controller passing rock
as genre
parameter.