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