title: In server-side Blazor, how to cancel a long-running background task of a page or component?
body: <p>Say I have a long running task that I've initialized and started from the OnInitializedAsync() method of my page class which is derived from Microsoft.AspNetCore.Components.ComponentBase. I use it to collect data and it updates the Ui from time to time, which works quite fine.</p>
  
  <p>But at some point I'll need to get rid of that background task. When the clients changes to another page or leaves the web app, I'd like to cancel my task so it wont keep on running for good.  I don't find an appropriate lifecycle method.</p>
  
  <p>Any suggestions?</p>