Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does ASP.NET Web Forms prevent a double click submission?

I'm working on an ASP.NET 4.0 Web Forms project, after a break of about 5 years, and I'm confused about the submit behaviour.

In the click event of a button, I sleep the thread so that I can click the submit button multiple times.

From what I can tell, ASP.NET is preventing the click event being called more than once. Is this true?

BTW: I've turned off javascript for this test.

like image 567
Jules Avatar asked Jul 24 '12 11:07

Jules


People also ask

How can we prevent double clicking or multiple form submission after ASP NET button is clicked?

On Click of ASP.Net Submit button, we disable the button using javascript so that user cannot submit it again. But disabling the button will prevent the form submission, as you cannot submit the form if the button is disabled. So we call the ASP.Net PostBack event method directly.

How can prevent double click on submit button in asp net MVC?

I have the following code for avoiding the double clic: jQuery. fn. preventDoubleSubmit = function () { var alreadySubmitted = false; return jQuery(this).

How can we prevent user from clicking button multiple times in asp net?

submit(function () { $('input[type=submit][data-loading]'). addClass('disabled'); if ($(this). data('submitted') == true) { $('input[type=submit][data-loading]'). attr('disabled', 'disabled'); return false; } $(this).


1 Answers

"ASP.NET is preventing the click event being called more than once. Is this true?"

No, actually what is happening to you is that your events are blocked by the lock of the session. (What session is on asp.net, is a module on asp.net that can keeps data for each user that visit the site)

So when you make a submit, and the page is running this submit, and then you make a second one before the first one replay, actually the second one is waiting the first to finish and unlock the session.

To make a test and prove that the session is locking your request, turn off the session and try again your test.

relative:
Web app blocked while processing another web app on sharing same session
What perfmon counters are useful for identifying ASP.NET bottlenecks?
Replacing ASP.Net's session entirely
Trying to make Web Method Asynchronous

like image 183
Aristos Avatar answered Oct 06 '22 23:10

Aristos