I am learning asp.net mvc form processing now and confused with the following:
What happens if we push the refresh button on the browser? It makes a POST or GET request?
I am learning asp.net mvc form processing now and confused with the following:
What happens if we push the refresh button on the browser? It makes a POST or GET request?
This is dependant on the last call that was made by the browser to get the current data. Eg:
a) If you submitted a form, performing a POST and then hit refresh, the browser will do another POST.
b) If you just clicked a link that took you to another page, performing a GET, you'll a refresh will perform a get.
If you're just starting out understanding the GET/POST methods, there is a nice pattern that you should understand that will help you not get in situations where data is posted again and again by users who constantly refresh the browser after a POST:
http://en.wikipedia.org/wiki/Post/Redirect/Get
and
An example specifically for asp.net MVC
Whatever HTTP method was used to generate the page will be repeated when you hit refresh.
If you're using <% Html.BeginForm(...) %>
when the form is submitted, it will create a POST, and if the resulting page is refreshed, it will repeat the POST.