title: How to avoid multiple calls to the same method c#
body: <p>I have a c# method , with asp on client side ,that is trigged at the moment a QR code is detected by the camera</p>
  
  <pre><code>protected void qrDetectado(object sender, EventArgs e)
  {
      .....
  }
  </code></pre>
  
  <p>however in some cases, it detects the same QR code more than once, and calls the qrDetectado method multiple times, resulting in a lot of troubles with the databases, etcetera.</p>
  
  <p>Is there a way to prevent multiplecalls to the same method at the same time </p>
  
  <p>Edit: Yeah just to clarify a little bit more, i call the method via js, and if it has already read a code i dont need it to run once more.</p>
  
  <p>Usually this kind of beheavior happens the first time it reads something, it has some kind of delay and the result is that i have like 3 or 4 times the same register in the database and some other issues, so, i only need to run it once, once it's done , keep reading</p>