URL : localhost:4835/ログイン
public class LoginController : Controller
{
public ActionResult Index()
{ 'enter code here' }
}
アクションの名前に言及せずにインデックスを呼び出したい。
URL : localhost:4835/ログイン
public class LoginController : Controller
{
public ActionResult Index()
{ 'enter code here' }
}
アクションの名前に言及せずにインデックスを呼び出したい。
RouteConfig
ファイルには次のようなものが必要です。
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Your Default Controller Name", action = "Default Action name(usually Index)", id = UrlParameter.Optional }
);
ここでサンプルを提供するだけで、独自のマッピングを作成できます。