D
Dominic
Hi there,
Suppose there is a "Submit" button on a ASP.NET page. Normally, after
a user hits the submit button, the code-behind will insert a row to
the database (or some database operations). Once it is completed,
another page will display.
Assume that the database operation takes a long time to finish (a few
seconds). After the user hits the submit button on the page once,
processing starts. Before the processing is done (and the second page
appears), the user hits the submit button again. Now, my question is
1. Will there be two requests submitted to the server?
2. Will two rows be inserted to the database (if no special checking
is done to prevent this from happening)?
3. What is the best way to prevent this from happening? Can we simply
use client-side script (e.g. javascript) to disable the "Submit"
button once it is hit so that the user cannot hit it the second time?
Is there any better and generic method of preventing this problem?
THanks
Dominic
Suppose there is a "Submit" button on a ASP.NET page. Normally, after
a user hits the submit button, the code-behind will insert a row to
the database (or some database operations). Once it is completed,
another page will display.
Assume that the database operation takes a long time to finish (a few
seconds). After the user hits the submit button on the page once,
processing starts. Before the processing is done (and the second page
appears), the user hits the submit button again. Now, my question is
1. Will there be two requests submitted to the server?
2. Will two rows be inserted to the database (if no special checking
is done to prevent this from happening)?
3. What is the best way to prevent this from happening? Can we simply
use client-side script (e.g. javascript) to disable the "Submit"
button once it is hit so that the user cannot hit it the second time?
Is there any better and generic method of preventing this problem?
THanks
Dominic