I checked a lot of methods on the Internet, but it is not easy to do so. I 'd like to write one by myself. The idea is to use Javascript to change the next onclick event of the button to return false on the client when the button is pressed; in this way, the server page will not Post to the server if you click the button again before sending it back to the client. At the same time, change the style of the button to a line of text, and the cursor will also become an hourglass. After the server page is re-generated, the Button returns to the initial state. This method does not prevent F5 refreshing, but simply closes the F5 button. To prevent another submission during refreshing, you can clear some TextBox controls before returning the page, in this way, you can judge that if the TextBox is empty, no subsequent operations (such as writing a database) will be performed ). Or jump to another page after the background operation is successful to prevent malicious refresh. It is mainly used in the enterprise intranet, not to prevent hackers, so it is not very strict.
<Html xmlns = "http://www.w3.org/1999/xhtml">
Run code
Copy code
Save code
Add to favorites