I have an ASP.NET-MVC application that:
- opens a db transaction
- updates a cart status and other things
- submits this cart to another web server via an HttpRequest
- register in database the transmission with its code status
- send a confirmation mail, that the command has been sent
- then if no error has occurs commit the transaction else rollback it.
Normally, after that the distant server sends another web request to my application to a controller action that will update the previous transmission and set an aknowledge field.
My problem is that the distant web server sometimes is very fast and sends the aknowledge status before the transmission insertion in the database is committed, so the update fails. How could I prevent this?
Thanks.