Second process seems to make first process crash (.net, c#)
<p>In a .net-webapplication, I have a module with the following code:</p>

<pre><code>protected void SaveButton_Click(object sender, EventArgs e)
{
   //..

   itemRepository.Create(store, validFrom);

   Item item = itemRepository.GetByStoreAndValidFrom(store, validFrom);

   //..

}
</code></pre>

<p>An item is created by the repository and then fetched from the database.<br/>
Sometimes, f.ex. if the user clicks on the button twice very quickly, the following seems to happen:<br/>
<strong>Two program processes of this module</strong> (please correct if the term not right!) start very closely after each other. Two items are created and the first process crashes because there is more than one item available in the database.<br/>
Is there a good way to handle this problem? I thought about putting a javascript blocker into the interface (to prevent the second button click) but would be thankful for hints.</p>
