Why is my asp.net mvc form POSTing instead of GETting?
Posted
by
quakkels
on Stack Overflow
See other posts from Stack Overflow
or by quakkels
Published on 2011-01-04T16:50:40Z
Indexed on
2011/01/04
16:53 UTC
Read the original article
Hit count: 280
My code is straightforward enough:
<% using(Html.BeginForm(FormMethod.Get)) %>
<% { %>
Search for in Screen Name and Email: <%: Html.TextBox("keyword", Request.QueryString["keyword"]) %>
<button type=submit>Search</button>
<% } %>
The issue I'm running into is that when I submit this form, the values are not added to the querystring. Instead, it appears that the form is submitting by a post request. When I look at the generated HTML, I have this:
<form action="/find/AdminMember/MemberList" method="post">
Search for in Screen Name and Email: <input id="keyword" name="keyword" type="text" value="" />
<button type=submit>Search</button>
</form>
Does anyone know why? This seems pretty simple and straighforward to me.
© Stack Overflow or respective owner