mvc3 不接受正确的 URL?
mvc3 not accepting proper URL?
我有一个名为 "TafelController.cs" 的控制器和一个名为 "Berekenen.cshtml" 的视图。 (名字不是我起的。)
url“http://localhost:5181/tafel/berekenen”不知何故不起作用,即使在向 berekenen 添加扩展名(如“.cshtml”)时也是如此。
将控制器和视图的名称取消大写也不起作用。
问题是,当我对 Index() 方法进行如下操作时,我得到了正确的视图。
public ActionResult Index()
{
return View("berekenen");
}
这很奇怪,因为那就是
http://localhost:portnum/tafel/berekenen
是。
将该页面设置为起始页时,URL 略有不同。
然后就变成了
http://localhost:5181/Views/tafel/berekenen.cshtml
有人知道会发生什么吗?
http://localhost:portnum/tafel/berekenen
正在尝试导航到 TafelController
上名为 Berekenen
的方法。您需要添加以下方法
public ActionResult Berekenen()
{
return View();
}
我有一个名为 "TafelController.cs" 的控制器和一个名为 "Berekenen.cshtml" 的视图。 (名字不是我起的。)
url“http://localhost:5181/tafel/berekenen”不知何故不起作用,即使在向 berekenen 添加扩展名(如“.cshtml”)时也是如此。 将控制器和视图的名称取消大写也不起作用。 问题是,当我对 Index() 方法进行如下操作时,我得到了正确的视图。
public ActionResult Index()
{
return View("berekenen");
}
这很奇怪,因为那就是
http://localhost:portnum/tafel/berekenen
是。 将该页面设置为起始页时,URL 略有不同。 然后就变成了
http://localhost:5181/Views/tafel/berekenen.cshtml
有人知道会发生什么吗?
http://localhost:portnum/tafel/berekenen
正在尝试导航到 TafelController
上名为 Berekenen
的方法。您需要添加以下方法
public ActionResult Berekenen()
{
return View();
}