【发布时间】:2011-02-04 07:35:15
【问题描述】:
我正在尝试以 files/id 格式获取我的 URL。我猜我的控制器中应该有两个 Index 方法,一个有参数,一个没有。但我在下面的浏览器中收到此错误消息。
无论如何这里是我的控制器方法:
public ActionResult Index()
{
return Content("Index ");
}
public ActionResult Index(int id)
{
File file = fileRepository.GetFile(id);
if (file == null) return Content("Not Found");
else return Content(file.FileID.ToString());
}
更新:添加路线完成。感谢杰夫
【问题讨论】:
标签: c# asp.net-mvc model-view-controller controller asp.net-mvc-routing