I have a controller called AccountController
which handles user-related actions.
I also defined a method:
//
// GET: /Account/Login
public ActionResult Login(string token)
{
//logic here
}
Why the following URL without token
specified would invoke the above action?
http://localhost/Account/Login
I would expect URL like http://localhost/Account/Login?token=abcdefgh
invoke the action ONLY.
This is my routing config:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Can anyone help? Thanks!