How to avoid the button events on Refresh of page

前端 未结 4 1109
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-09 16:45

I have .aspx page that page inserts the data to the database on a button click. But when i press the button it is going right. i m getting the Successfully message as \" success

4条回答
  •  旧巷少年郎
    2021-02-09 17:28

    The refresh will re-submit the form you posted last time when you clicked the button.

    Usually, when you refresh a page you think of GETing the page again, or doing an HTTP GET, but since the last thing you did was a POST (when you clicked the submit button) the browser will perform the post again to attempt to invoke the same response.

    I suggest using the Post/Redirect/Get pattern as suggested by Jorn Schou-Rode.

    This article also seems relevant. http://aspalliance.com/687_Preventing_Duplicate_Record_Insertion_on_Page_Refresh

提交回复
热议问题