【发布时间】:2011-03-28 12:24:58
【问题描述】:
我正在试用 ASP.NET MVC2。我有一个名为 SearchController 的控制器和一个名为 Search 的包含 Search.aspx 的视图文件夹。 在我的控制器中,我有:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Post()
{
HPSLucene.Models.Arbitrary arb = new HPSLucene.Models.Arbitrary();
arb.Title = "Post received";
return View("Search",arb);
}
在我看来,我有:
<form action="Search/Post" method="post">
<label><% Response.Write(Model.Title); %></label>
<input type="Submit" Value="First" Name="submitButton"/>
</form>
当我第一次单击该按钮时它工作正常,并且浏览器显示一个http://localhost:1824/Search/Post 的网址。但是,当我第二次单击该按钮时,浏览器 url 更改为 http://localhost:1824/Search/Search/Post 并且我得到 404。我做错了什么?非常感谢。
【问题讨论】:
标签: asp.net-mvc url asp.net-mvc-2 http-post