Asp.Net SQL Refresh page duplicate inserts?

前端 未结 4 1666
悲哀的现实
悲哀的现实 2021-01-24 16:51

I have a *.aspx page that contains a text box and a button. When the user enters information in to the textbox and clicks post, it inserts the data into my sql database. The iss

4条回答
  •  有刺的猬
    2021-01-24 17:43

    It would be preferable to redirect the client to another page after the insert, however, if you really need the client stay in the same page, you can use a (bool) variable on your page to state if the insert has been done, and skip the insert logic if it has been executed before

提交回复
热议问题