• Post Reply Bookmark Topic Watch Topic
  • New Topic

Related to "Stop new request on page refresh"

 
Manan Panchal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have some confusion.

Suppose, one page with "login" link on it.

We press the link and (1) GET request sent and server responded with login page.
We fill the form and press login button and (2) POST request sent, and if login will successful then server redirects a page with some user information with (3) GET request.

So, here request history like this according to number (1) GET, (2) POST, (3) GET.
Now, we press "Back" of browser, then why do browser sent (1) GET? why not (2) POST?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35744
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The redirect "breaks" the request in two. Therefore for a redirect, refresh uses the GET page and back gets the POST page.

However, I think the page you are describing is using a forward rather than a redirect. That treats the POST/GET as one request. Hence refresh will do the POST/GET again and back gets the original GET.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!