-1
I am with a web form, in which I have this code:
<form action="../../MenuPrincipal" method="POST" class="form-inline">
<button type="submit">
</form>
and my file structure is like this:
My form is in the file pesquisasSp1Pesquisar.cshtml
The problem is this... When I do Submit, it goes to the correct url, but with this error:
I know the url is correct because if I click there and hit enter, reloading, it opens correctly:
OBS: It doesn’t work if I press F5.
To show you better what’s going on:
https://drive.google.com/file/d/1DHWIXroacGBZI-g3NDxbqZdUjleNagcS/view?usp=sharing
EDIT1: At Alisson’s request, I changed my action to Sp1Psearch in order to call the Onpost that is on this page. Result:
Code:
Apparently the problem is you are giving POST on the Menu/Menuprincipal route and it has only predicted the GET.
– Alisson Marqui
@Alissonmarqui. I have the get of the page done and regarding my post I have just this:
public IActionResult OnPost(){ return Page();}
. It’s wrong for me to leave the form action like that?– user153240
You really will make a POST of some information, or just want to redirect from one page to another ? This Onpost is on Menuprincipal ?
– Alisson Marqui
I will do the post some information yes... The Onpost is in the file . Cs of the page searchSp1Psearch
– user153240
In your form you are pointing to a Post on the route of Menuprincipal, then this Onpost should stay there.
– Alisson Marqui
then in my onpost, I must make a redirect so I can get back to Menuprincipal?
– user153240
if I remove the "action" from the form and put in my onpost a
Response.Redirect("../../MenuPrincipal")
so in theory it was supposed to work?– user153240
Let’s go continue this discussion in chat.
– Alisson Marqui