I have the Home Controller and my Action name is Index. In My route config the routes like below.
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Now I call my page like http://localhost:11045/Home/Index
is correct.
If I call my page like following it should redirect to error page.localhost:11045/Home/Index/98
orlocalhost:11045/Home/Index/?id=98
.
How to handle this using routing attribute.
My Action in Controller look like below.
public ActionResult Index()
{
return View();
}