Scenario:- I have url in the following pattern:-
localhost:8080/albums/
routes.MapRoute(
{
name: "AlbumHome",
url : "Albums/{*albumName}"
defaults: new {controller = "Albums", action="Index", albumName = ""}
}
Now in my action, I am getting the albumName from the DB, now how should I append the albumName in the url.
I want the url to be as:-
localhost:8080/albums/hindi
localhost:8080/albums/kanada
and so on.
Action
public ActionResult GetAlbumName()
{
//get the albumName from db
return RedirectToRoute("AlbumHome",albumName);
}
public ActionResult Index(string albumName)
{
return view();
}
How to append this albumName in url?