-1

URL : localhost:4835/Login

public class LoginController : Controller
{
    public ActionResult Index()
    { 'enter code here' }
}

i want to call index without mention a name of action.

1 Answers1

1

You should have something like this in your RouteConfig file:

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Your Default Controller Name", action = "Default Action name(usually Index)", id = UrlParameter.Optional }
);

You can have your own mappings, just provided a sample here.

Ryan Searle
  • 1,597
  • 1
  • 19
  • 30
SamGhatak
  • 1,487
  • 1
  • 16
  • 27