所以我在我的共享布局页面上有一个表单,我想简单地发布一个文本字符串。我目前在控制器中该操作的开头有一个断点,以测试表单是否正常工作,但它似乎永远不会到达那里,因为它从未达到断点。这是我的代码有人知道我做错了什么吗?
看法:
<form action="/RespondentSearch/Search" method="post" class="sidebarSearch">
<input type="text" name="search" placeholder="respondent search..." id="ac" class="ui-autocomplete-input" autocomplete="off" /><span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input type="submit" value="" href="#moadalSearch" rel="lightbox" />
</form>
控制器:
public class RespondentSearchController : Controller
{
[HttpPost]
public ActionResult Search(string search)
{
string stuff = search;
return View();
}
}
我的 Visual Studio 调试控制台虽然读起来像是有异常?
Following route: {controller}/{action}/{id} for request: http://localhost:56554/RespondentSearch/Search
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
Following route: {controller}/{action}/{id} for request: http://localhost:56554/Home/Login
Following route: {controller}/{action}/{id} for request: http://localhost:56554/
我的开发者工具浏览器调试:
Request URL:http://localhost:56554/RespondentSearch/Search
Request Method:POST
Status Code:302 Found
search:asdf <--- This is what I was typing in
看来它已经到了那里,但我还没有达到我的断点?我还为它添加了一个临时视图,以便在它存在时只输出一些东西,但仍然什么也没有。就好像它完全避免了我的控制器动作。