我遇到了一个令人困惑的错误,我不太清楚为什么。[HttpPost]
通常,当您有两个 ActionResult 并忘记其中一个时,会弹出这种错误。但是正如您所看到的,我有 [HttpPost]
,那么可能导致此问题的原因是什么?
错误:Type 'PersonalWebsite.Controllers.BlogController' already defines a member called 'Search' with the same parameter types Controllers\BlogController.cs
和代码:
//
// GET: /Blog/Search
public virtual ActionResult Search()
{
return RedirectToAction(MVC.Blog.Index());
}
//
// POST: /Blog/Search
[HttpPost]
[ValidateInput(false)]
public virtual ActionResult Search(SearchViewModel model)
{
// irrelevant code snipped
return View(model);
}
Search()
此控制器中没有定义其他方法。这很奇怪。
有任何想法吗?