Q:

asp.net MVC routing eror 404

i dont understand the rooting in ASP.net ; im missing something with this ?
this is my root :
 routes.MapRoute(
                name: "ChampionID",
                url: "Champion/ChampionById/id",
                defaults: new { controller = "Champion", action = "ChampionById", id = "5" }
            );

this is my Controler :
public class ChampionController : Controller
{
    public ActionResult ChampionById(string x)
    {
        ChampionId ch = new ChampionId();
        ch.Id = x;
        return View(ch);
    }

if you can help me with this i will be thankful

A:

Forget routes.MapRoute.  Just wire up all routes and then put the route as an attribute like this:
public class ChampionController : Controller
{
    [Route("Champion/ChampionById/{id}")]
    public ActionResult ChampionById(string id)
    {
       ChampionId ch = new ChampionId();
       ch.Id = id;
       return View(ch);
    }
}

Also x should be id.  Then just remove routes.MapRoute.  Then make sure you have a corresponding cshtml file called ChampionById.

