Mvc提交

Controller

 [ValidateAntiForgeryToken]
 [HttpPost]
 public ActionResult Index(FormCollection focm)
 {
     string name = focm["Name"];
     ViewBag.Message = name;
     return View();
 }

View

<div>欢迎 @ViewBag.Message 先生</div>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken();    
    @Html.Label("姓名:")
    @Html.TextBox("name");
    <input type="submit" value="确定" />
}

 

posted @ 2015-10-27 05:02  gobuild  阅读(174)  评论(0编辑  收藏  举报