문제

I have an HTML form which I want to post data to then display some text to the user. I've heard several people discuss this idea:

should the user go from [form page] -> [processing form post page] -> [display page] or should the user just go to a combined [form page] -> [processing form / display page]

I've heard arguments the former is more secure while the latter is less redirects.

What are some answers?

도움이 되었습니까?

해결책

To avoid caching issues, resubmission on refresh issues and similar problems: Use the POST-REDIRECT-GET pattern.

  1. Browser makes HTTP POST request with form data
  2. Server processes data and responds with a redirect response
  3. Browser makes HTTP GET request (possibly including an id that is related to the submitted data in the query string)
  4. Server responds with a 200 response and the information

다른 팁

From what your question asked, you could just have the [form page] -> [form page to process and display].

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top