そのため、共有レイアウト ページに、テキスト文字列を単純に投稿したいフォームがあります。現在、フォームが機能していることをテストするためにコントローラーのアクションの先頭にブレークポイントがありますが、ブレークポイントに到達しないため、そこに到達しないようです。これが私のコードです。誰かが私が間違っていることを知っていますか?
意見:
<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
そこに到達しているように見えますが、まだブレークポイントに達していませんか? また、そこに何もないときに何かを出力するための一時ビューも追加しました。コントローラーのアクションを完全に回避しているようです。