Data being sent as query string instead of Form data
-
26-07-2021 - |
Question
In my form I see that the data is being sent as Querystring instead of form data (that I expect it to).
My page:
@using (Html.BeginForm("AAForm", "Test", FormMethod.Post, new { id = "myAForm" }))
{
<label for="a">A</label>
<input id="aid" name="aname" style="width: 300px" required validationMessage="Select"/>
<button type="submit" class="btn btn-primary" value="aa" > Go </button>
}
ControllerSignature
public ActionResult GetValues(FormCollection formCollection){ //Some code }
And I am making an AJAX call to GetValues().
What could I be doing wrong? Pls let me know if I should be posting more information.
Another question: What is "_:" in the query string? And it has some random number value.
Thanks.
Solution
add an [HttpPost]
attribute on your ActionResult
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow