I have an MVC application and the url looks like this;
/celebritypage/celebrityname=Elma Fudd
What I'd like is to only have;
/celebritypage/Elma Fudd
Is this possible within routing?
I have an MVC application and the url looks like this;
/celebritypage/celebrityname=Elma Fudd
What I'd like is to only have;
/celebritypage/Elma Fudd
Is this possible within routing?
Sure, something like this should work:
routes.MapRoute(
"RouteName",
"celebritypage/{name}",
new { controller = "celebritypage", action = "celebrityname" }
);
Then make sure your controller action is ready for the parameter:
//inside celebritypage Controller
public ActionResult celebrityname(string name) {
//code
return View("ViewName");
}