✅ How do I abort a long running API request manually?
Hi, I'm having a bit of trouble simply cancelling a long running request on a separate ASP.Net Web API.
I've intergrated the CancellationToken into my endpoint to handle it properly when it's fired from the browser (when the back button is pressed or window is closed)
The browser magically sends this cancellation token to my endpoint if the browser is closed or something. This works great.
How I do this manually? Like if I want a button the user can press on the front-end to cancel the process on the back-end.
I've been looking at this :
https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort
but that's JavaScript of course and I'm not sure how to integrate that.
Thanks!
I've intergrated the CancellationToken into my endpoint to handle it properly when it's fired from the browser (when the back button is pressed or window is closed)
The browser magically sends this cancellation token to my endpoint if the browser is closed or something. This works great.
How I do this manually? Like if I want a button the user can press on the front-end to cancel the process on the back-end.
I've been looking at this :
https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort
but that's JavaScript of course and I'm not sure how to integrate that.
Thanks!
MDN Web Docs
The abort() method of the AbortController interface aborts an asynchronous operation before it has completed.
This is able to abort fetch requests, the consumption of any response bodies, or streams.
This is able to abort fetch requests, the consumption of any response bodies, or streams.
