Webforms Refresh problem

后端 未结 2 1529
清酒与你
清酒与你 2020-12-22 07:27

This is probably a simple question for every WebForms developer but I am knew to this scene. I have a page that has an \"ADD\" button on it that results in a jquery popup w

相关标签:
2条回答
  • 2020-12-22 08:11

    that's a common problem. Here's explanation and solution of the problem.

    When a web form is submitted to a server through an HTTP POST request, a web user that attempts to refresh the server response in certain user agents can cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplicate web purchase. To avoid this problem, many web developers use the PRG(Post/Redirect/Get) pattern.

    copied from wiki (LINK)

    simplest solution can be Response.Redirect to the same page (i.e. if you page is named default.aspx write Response.Redirect("default.aspx")). if you do this browser refresh button will just load the page as if you have typed in address bar URL and navigated to it.

    here's SO question How to stop unwanted postback that might be useful as well.

    0 讨论(0)
  • 2020-12-22 08:21

    If there is an option to delete an item on the page (is there?), do you really have to be concerned with that happening? May want to think about that. Just a thought.

    0 讨论(0)
提交回复
热议问题