So I’m thinking about a functionality where the user pastes a link and the server-side code crawls the provided link and responds with the contents of that link (such as page title, description, thumbnail, etc).
The user can meanwhile change the link, and in doing that, the ajax-request should be aborted client-side.
I’m wondering what exactly happens in the IIS server and specifically to my C# code.
- Is the response thread terminated?
- Does the Response object now return null, or Response.Write throw exceptions?
- Is an exception thrown in the response thread just whereaver it is? (that one doesn’t even make sense, but whatever)
If the server code checks the state of
Response.IsClientConnected, it can stop the work and produce an empty response when the client aborts the request, otherwise it will just complete the request as usual.The request handling will not be aborted automatically just because there is noone waiting for it any more. The server code has to actively check the state of the request.