網址,我有以下formin我的觀點:更好的結構,從MVC beginform
@using (Html.BeginForm("Index", "ToolsForHire", FormMethod.Get))
{
<p>tool required: @Html.TextBox("tool")</p>
<input type="submit" value="search" />
}
提交這份表格員額:
localhost:54124/ToolsForHire?tool=mytooltext
這一切工作正常。
但是我想發生的是,我的網址結束是:
localhost:54124/ToolsForHire/mytooltext
仍然得到與MVC交手所以有些建議是好的?
請問您可以擴展一個例子嗎? – Simon
啊!您可以將Httpget改爲Httppost @using(Html.BeginForm(「Index」,「ToolsForHire」,FormMethod.Post))並在控制器中添加一個帶名稱的參數(字符串工具) – Miller
是的,但不會將它包含在url將它,看到我上面的最新評論... – Simon