Because this is not the correct way to implement URL Routing in ASP.NET. When you create URLs you do so this way,
routes.MapRoute(
name: "Default1",
url: "/{id}/{controller}/{action}",
defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional }
);
Since Login is controller, I have added
{controller}
in its place, constants are never resolved and mapped to any code-behind logic such as Controller, Action or other parameters. The parameters for controller, action or any other ID or other parameters are passed in
{}
blocks. You cannot pass your own variables or constant literals. If you want to, then you should accept them on your server also; such as id. It would be passed to your action as,
public ActionResult Login(int id) { }
You can pass your own variables in a very similar manner; such as username string.