ASP .Net custom route not working.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//default route
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Account", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
);
//custom route
routes.MapRoute(
"Admin",
"Admin/{addressID}",// controller name with parameter value only(exclude parameter name)
new { controller = "Admin", action = "address" }
new { addressID = @"\d+" }
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
public ActionResult address(int addressID = 0)
{
//code and redirection
}
Here I want to hide everything from the url if possible...like i want to hide action name and parameter name and value if possible... Suggest me the possible way to do this
Like I want URL like this (on priority basis)
1.http: //localhost:abcd/Admin
or
2.http: //localhost:abcd/Admin/address
or
3.http: //localhost:abcd/Admin/1
or
4.http: //localhost:abcd/Admin/address/1