Browser waits for ajax call to complete even after abort has been called (jQuery)

后端 未结 7 1604
野趣味
野趣味 2020-12-01 05:27

I have some (potentially) long-running ajax calls that I would like to abort if the user navigates to another page. The following jQuery code calls abort on all pending XMLH

7条回答
  •  没有蜡笔的小新
    2020-12-01 06:13

    Thank you for your replies! It turns out I was completely wrong about this being a browser issue - the problem was on the server. ASP.NET serializes requests of the same session that require session state, so in this case, the next page didn't begin processing on the server until those ajax-initiated requests completed.

    Unfortunately, in this case, session state is required in the http handler that responded to the ajax calls. But read-only access is good enough, so by marking the handler with IReadOnlySessionState instead of IRequiresSessionState, session locks are not held and the problem is fixed.

    Hope this information proves useful to others.

提交回复
热议问题