I would like to know why the action is not executed Welcome
.
HelloWorldController.cs
public class HelloWorldController : Controller
{
//
// GET: /HelloWorld/
public string Index(string name)
{
return "This is my default action...";
}
//
// GET: /HelloWorld/Welcome/
public string Welcome()
{
return "This is the Welcome action method...";
}
}
startup.cs
routes.MapRoute(
name: "default",
template: "{controller=HelloWorldController}/{action=Welcome}/{id?}");
If your file is misconfigured
Startup.cs
, you should consider the name of the controller.Reference: