How to handle / cancel concurrent request by same user asp.net
<p>I'm writing an asp.net application.
When a user view page XXX.aspx a lot of calls is done to a back-end application which provide data and business logic. I have an API from that back-end application which i use to call methods to execute business logic and get data.</p>

<p>My problem is as follows:
If a user hits repeatedly F5 (or even just holds it down) then several web request will be executed at the same time. This again forces me to open several connections to the back-end application. To open connection is a expensive so I have implemented a caching mechanism so that a user session get's a connection and sticks to that connection until it's returned to an connection pool after about 15 seconds. If I activate the caching mechanism the connection towards the back-end app crashes when I hit F5 fast. This happens because all of the request's are processed at the same time and therefore try to use the same connection simultaneously. This is not "legal". Fare enough :)
I have added a sleep function so that a connection will only be used by a single request at any give time. But again this is slow and if I hit the F5 20 times i will have to wait the about 15-20 seconds before the "last" response is shown. I don't want to process all these request. I have tried holding down F5 at other asp.net applications on the web and I notice that some have this problem, other not.</p>

<p>This must be a quite common problem, but I cannot find any good information about this.
Are there any settings in asp.net that will cancel all request prior to the latest or do I have to implement my own system for this?
Are there any best practices around this kind of situation?</p>

<p>To provide a more common valid example:
Let's say that a page request did 5 selects towards a sql server an a user hits F5 20 times super fast. To execute 5*20 selects is what I want to avoid, probably 10 of the selects will be executed since it takes some time to hit F5 like this, but once there is a build-up of request only the last should be executed.</p>

<p>Thanks in advance!</p>

<p><strong>Update/additional info:</strong> </p>

<ul>
<li>The content "cannot" be cached. Also by default, any caching is/should be done in back-end system making distributed cache possible and also making cache available to other applications running on top of back-end system. </li>
<li>Each session gets it's own connection to back-end.</li>
<li>The page is "fast", loading at 750-1000ms.  (But I'm a lot faster at pushing F5...)</li>
</ul>

<p>If no better solution appear I will create a version number in session object or similar. Before doing any call towards the back-end there will be a compare with current request version number against the version number in session. Only request that match the latest version number will be executed. For my ajax pages this check will be skipped so that concurrent ajax calls are possible.
It might also be that I will resort to some kind of very short lived caching in asp.net, but it opens a whole new world of issues. This is after all a problem that will occur seldom and it's furthermore impossible to prohibit completely due to the fact that I'm designing the asp.net solution to be more or less stateless. But if there is 2 or even more web servers there will still be benefit in the "version" system.</p>

<p>Thanks so far for good suggestions and interesting opinions!</p>
