This is my controller :
[HttpPost]
public ActionResult TestePost(int id1)
{
ViewData["Teste"] = "O método POST funcionou, você digitou: " + id;
return View("Index");
}
[HttpGet]
public ActionResult TesteGet(int id)
{
ViewData["Teste"] = "O método GET funcionou, você digitou: " + id;
return View("Index");
}
Below my view :
@using (Html.BeginForm("TesteGet", "Home", FormMethod.Get))
{
<fieldset>
<legend>Form tipo GET</legend>
<input type="text" name="id" id="idGet" value="" />
<input type="submit" name="enviar" value="enviar Get" placeholder="apenas numeros" />
</fieldset>
}
<br/>
<hr/>
<br/>
@using (Html.BeginForm("TestePost", "Home", FormMethod.Post))
{
<fieldset>
<legend>Form tipo POST</legend>
<input type="text" name="id1" id="idPost" value="" />
<input type="submit" name="enviar" value="enviar Post" placeholder="apenas numeros"/>
</fieldset>
}
<h1>@ViewData["Teste"]</h1>
My problem: Method GET
works perfectly, post
method does not work.
Highlight: When is localhost works perfectly POST and GET when I put in Locaweb gives this error.