有一个非常简单的形式,不会将任何数据发送回我的控制器。
控制器:
public class SurveysController : Controller
{
private IAdminBusinessLogic _logic;
//
// GET: /Admin/Surveys/
public SurveysController(IAdminBusinessLogic logic)
{
_logic = logic;
}
public ActionResult Index()
{
ViewBag.Tables = _logic.ListTables();
return View();
}
public ActionResult AddTable()
{
return View();
}
[HttpPost, ActionName("AddTable")]
public ActionResult AddTablePost()
{
return Content(Request.Form["submit"]);
}
}
查看
@{
ViewBag.Title = "Add Table";
Layout = "";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm())
{
<input type="submit" id="submit" value="Delete" />
}
的Fiddler
POST http://localhost:56366/Admin/Surveys/AddTable HTTP/1.1
Host: localhost:56366
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0) Gecko/20120204 Firefox/10.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://localhost:56366/Admin/Surveys/AddTable
Cookie: __utma=111872281.928520945.1315324301.1325785813.1325895119.6; __utmz=111872281.1315324301.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
答案 0 :(得分:1)
fiddler请求显示没有后期数据。 Content-Length为零。那是因为您的输入缺少名称。