title: Execute SQL Server request in the callback of an HttpWebRequest
body: <p>My understanding is that two <code>HttpWebRequest</code> callback can be executed at the same time because the request are asynchronous. However, I want to work with the database on the callback, and it seems not possible with SQL Server. What is the best practice in this case ? Is there a way to add these requests to a queue, or should I use something like mutexes (which I would prefere to avoid, since deadlocks are difficult to debug) ?</p>
  
  <p>edit: My current code doesn't do anything special to prevent that. I fire multiple (different) requests and sometimes in one of the callbacks I get a exception thrown ("Invalid Cross Thread Access") when I try to submit the changes to the database.</p>
  
  <p>I tried to use <code>Dispatcher.BeginInvoke</code> but now I have doubts that it's doing what I want after some googling (I used <code>Dispatcher.BeginInvoke</code> before successfuly when accessing elements in my XAML, so I thought it could fix my problem accessing the db)</p>