Jules Jules - 1 month ago 15
ASP.NET (C#) Question

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.

Answer

"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

Comments