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.
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.
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.