1
我有趣的Visual Studio 2008 MVC應用程序。C#:爲什麼我的控制器不能識別[HttpGet]?
我想用[HttpGet]和[HttpPost]兩個方法/相同的名稱。
[HttpGet]
public ViewResult RsvpForm()
{
return View();
}
[HttpPost]
public ViewResult RsvpForm(GuestResponse guestResponse)
{
//To do: Email guestresponse
return View("Thanks", guestResponse);
}
我得到這個錯誤:錯誤2類型或命名空間名稱「HttpGetAttribute」找不到(是否缺少using指令或程序集引用?)
但我輸入以下內容:使用系統; using System.Collections.Generic;使用System.Linq的 ; using System.Web; using System.Web.Mvc; 使用PartyInvites.Models;使用System.Net的 ;使用System.IO的 ; using System.Text; using System.Web.Mvc.Resources; using System.Web.Mvc.Html; using System.Web.Mvc.Ajax;
你能發佈一些代碼? – 2011-02-03 16:28:29
以及任何錯誤消息或症狀。 – 2011-02-03 16:29:38